Prechádzať zdrojové kódy

Merge branch 'web_sannong_fr' into dev

15313670163 1 mesiac pred
rodič
commit
314d47f5ea
1 zmenil súbory, kde vykonal 13 pridanie a 11 odobranie
  1. 13 11
      app/JsonRpc/NewsService.php

+ 13 - 11
app/JsonRpc/NewsService.php

@@ -855,10 +855,14 @@ class NewsService implements NewsServiceInterface
             if(empty($website)){
                 return Result::error("暂无此网站",0); 
             }
-            if (isset($data['sur_id']) && !empty($data['sur_id'])) {
-                $survey = ArticleSurvey::where('sur_id', $data['sur_id'])->where('website_id', $data['website_id'])->pluck('sur_id');
-                if (empty($survey)) {
-                    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();
+                return Result::success($survey);
+                if(empty($survey)){
+                    return Result::error("此调查问卷不存在",0);
                 }
                 // return Result::success($survey);
                 // 调查问卷类型   
@@ -885,8 +889,9 @@ class NewsService implements NewsServiceInterface
                         ->where('other_id', '!=', 0)
                         ->first();
                     // return Result::success($data);
-                    if (!empty($choice['other'])) {
-                        array_push($data['choice_id'], $choice['other']['other_id']);
+                    $choice_id = $data['choice_id'];
+                    if(!empty($choice['other'])){
+                        array_push($data['choice_id'],$choice['other']['other_id']);
                         // return Result::success($data['choice_id']);
                     }
                     // return Result::success($data);
@@ -896,11 +901,8 @@ class NewsService implements NewsServiceInterface
                     if (empty($choice)) {
                         return Result::error("请选择已有的选项!", 0);
                     }
-                    $retult_survey['data'] = ArticleSurvey::where('website_id', $data['website_id'])
-                    ->where('sur_id', $data['sur_id'])
-                    ->get();
-                    $retult_survey['choice'] = $data['choice_id'];
-                    return Result::success($retult_survey);
+                    $survey['choice'] = $choice_id;
+                    return Result::success($survey);
                 }
                 return Result::error("参数必填!"); 
             }