AI пре 1 месец
родитељ
комит
a3f7bef35c
1 измењених фајлова са 8 додато и 7 уклоњено
  1. 8 7
      app/JsonRpc/NewsService.php

+ 8 - 7
app/JsonRpc/NewsService.php

@@ -260,7 +260,8 @@ class NewsService implements NewsServiceInterface
             if ($is_survey == 1) {
                 //生成年月日时分秒+8位随机数
                 $uuid = date('YmdHis') . rand(10000000, 99999999);
-                $suveys_array = json_decode($suvey_array);
+                var_dump($suvey_array, 'suvey_array________');
+                $suveys_array = is_array($suvey_array) ? $suvey_array : json_decode($suvey_array);
                 var_dump($suveys_array, '---------------------1');
                 var_dump($suvey_array, '---------------------2');
                 $suvey_data = [];
@@ -276,7 +277,7 @@ class NewsService implements NewsServiceInterface
                             'survey_name' => $survey_name,
                             'choice_name' => $value[1],
                             'is_other' => 1,
-                            'orther_id' => 0,
+                            'other_id' => 0,
                             'results' => 0,
 
                         ];
@@ -288,7 +289,7 @@ class NewsService implements NewsServiceInterface
                             'survey_name' => $survey_name,
                             'choice_name' => $value,
                             'is_other' => 0,
-                            'orther_id' => 0,
+                            'other_id' => 0,
                             'results' => 0,
 
                         ];
@@ -370,13 +371,13 @@ class NewsService implements NewsServiceInterface
             //处理投票
             $id = $data['id'];
             $surveydata = ArticleSurvey::where(['art_id' => $data['id']])->delete();
-            var_dump($surveydata, 'suvey_array________delete');
+            var_dump($suvey_array, 'suvey_array________delete');
 
             //处理投票
             if ($is_survey == 1) {
                 //生成年月日时分秒+8位随机数
                 $uuid = date('YmdHis') . rand(10000000, 99999999);
-                $suveys_array = json_decode($suvey_array);
+                $suveys_array = is_array($suvey_array) ? $suvey_array : json_decode($suvey_array);
                 var_dump($suveys_array, '---------------------1');
                 var_dump($suvey_array, '---------------------2');
                 $suvey_data = [];
@@ -393,7 +394,7 @@ class NewsService implements NewsServiceInterface
                                 'survey_name' => $survey_name,
                                 'choice_name' => $value[1],
                                 'is_other' => 1,
-                                'orther_id' => 0,
+                                'other_id' => 0,
                                 'results' => 0,
 
                             ];
@@ -405,7 +406,7 @@ class NewsService implements NewsServiceInterface
                                 'survey_name' => $survey_name,
                                 'choice_name' => $value,
                                 'is_other' => 0,
-                                'orther_id' => 0,
+                                'other_id' => 0,
                                 'results' => 0,
 
                             ];