소스 검색

获取投票结果

15313670163 1 개월 전
부모
커밋
add380dc00
1개의 변경된 파일6개의 추가작업 그리고 5개의 파일을 삭제
  1. 6 5
      app/JsonRpc/NewsService.php

+ 6 - 5
app/JsonRpc/NewsService.php

@@ -572,12 +572,9 @@ class NewsService implements NewsServiceInterface
                 return Result::error("暂无此网站",0); 
             }
             if(isset($data['sur_id']) && !empty($data['sur_id'])){
-                $survey['data'] = ArticleSurvey::where('sur_id',$data['sur_id'])
-                ->where('website_id',$data['website_id'])
-                ->where('other_id', 0)
-                ->get();
+                $is_survey = ArticleSurvey::where('sur_id',$data['sur_id'])->first();
                 // return Result::success($survey);
-                if(empty($survey)){
+                if(empty($is_survey)){
                     return Result::error("此调查问卷不存在",0);
                 }
                 // return Result::success($survey);
@@ -627,6 +624,10 @@ class NewsService implements NewsServiceInterface
                     if(empty($choice)){
                         return Result::error("请选择已有的选项!",0);
                     }
+                    $survey['data'] = ArticleSurvey::where('sur_id',$data['sur_id'])
+                    ->where('website_id',$data['website_id'])
+                    ->where('other_id', 0)
+                    ->get();
                     $survey['choice'] = $choice_id;
                     return Result::success($survey);
                 }