Prechádzať zdrojové kódy

Merge branch 'web_sannong_fr'

15313670163 6 dní pred
rodič
commit
d0f919a74a
1 zmenil súbory, kde vykonal 27 pridanie a 27 odobranie
  1. 27 27
      app/JsonRpc/NewsService.php

+ 27 - 27
app/JsonRpc/NewsService.php

@@ -1028,10 +1028,10 @@ 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'])->where('is_other', 1)->where('other_id', 0)->first();
-                if (empty($survey)) {
-                    return Result::error("此调查问卷不可添加选项", 0);
+            if(isset($data['sur_id']) && !empty($data['sur_id'])){
+                $survey = ArticleSurvey::where('sur_id',$data['sur_id'])->where('is_other',1)->where('other_id',0)->first(); 
+                if(empty($survey)){
+                    return Result::error("此调查问卷不可添加选项",0); 
                 }
                 if (isset($data['choice_name']) && !empty($data['choice_name'])) {
                     $choice = [
@@ -1085,19 +1085,19 @@ class NewsService implements NewsServiceInterface
                         $data['choice_id'] = [$data['choice_id']];
                     }
                     $data['choice_id'] = array_map('intval', $data['choice_id']);
-                    $other = ArticleSurvey::whereIn('id', $data['choice_id'])
-                        ->where('website_id', $data['website_id'])
-                        ->where('is_other', 1)
-                        ->where('other_id', 0)
-                        ->first();
-                    if (!empty($other)) {
-                        return Result::error("请选择已有的选项!", 0);
+                    $other = ArticleSurvey::whereIn('id',$data['choice_id'])
+                    // ->where('website_id',$data['website_id'])
+                    ->where('is_other',1)
+                    ->where('other_id',0)
+                    ->first();
+                    if(!empty($other)){
+                        return Result::error("请选择已有的选项!",0);
                     }
-                    $choice['other'] = ArticleSurvey::whereIn('id', $data['choice_id'])
-                        ->where('website_id', $data['website_id'])
-                        ->where('is_other', 1)
-                        ->where('other_id', '!=', 0)
-                        ->first();
+                    $choice['other'] = ArticleSurvey::whereIn('id',$data['choice_id'])
+                    // ->where('website_id',$data['website_id'])
+                    ->where('is_other',1)
+                    ->where('other_id','!=',0)
+                    ->first();
                     // return Result::success($choice['other']);
                     $choice_id = $data['choice_id'];
                     if (!empty($choice['other'])) {
@@ -1115,16 +1115,16 @@ class NewsService implements NewsServiceInterface
                         array_push($data['choice_id'], $choice['other']['other_id']);
                     }
                     // return Result::success($data);
-                    $choice = ArticleSurvey::whereIn('id', $data['choice_id'])
-                        ->where('website_id', $data['website_id'])
-                        ->increment('results', 1);
-                    if (empty($choice)) {
-                        return Result::error("请选择已有的选项!", 0);
+                    $choice = ArticleSurvey::whereIn('id',$data['choice_id'])
+                    // ->where('website_id',$data['website_id'])
+                    ->increment('results', 1);                 
+                    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['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);
                 }
@@ -1736,8 +1736,8 @@ class NewsService implements NewsServiceInterface
         }, $data);
         return Result::success($result);
     }
-    /**
-     *获取头条类新闻模块-合集
+     /**
+     *获取头条类新闻模块-合集(暂时用不到)
      * @param array $data
      * @return array
      */