OMEGA\ericyh.huang 1 年之前
父節點
當前提交
b3a10501c7
共有 1 個檔案被更改,包括 9 行新增2 行删除
  1. 9
    2
      src/be/app/Http/Controllers/HealthyPassPortController.php

+ 9
- 2
src/be/app/Http/Controllers/HealthyPassPortController.php 查看文件

@@ -61,6 +61,14 @@ class HealthyPassPortController extends Controller
61 61
                                 "healthAge" => $healthAge,
62 62
                                 "healthGender" => $healthGender,
63 63
         ];
64
+        $survey_data = Survey::where('line_user_id',$lineUserId)->first();
65
+        if(!empty($survey_data->id)){
66
+            $filler_content = json_decode($profile->filler_content, true);
67
+            $clearAction = [];
68
+            foreach($filler_content as $key => $content){
69
+                array_push($buildActions, $this->buildActionsRequest("removeTag", $content));
70
+            }
71
+        }
64 72
         
65 73
         //準備將填寫內容過API寫入 botbonnie 後台
66 74
         $buildActions = [];
@@ -82,7 +90,6 @@ class HealthyPassPortController extends Controller
82 90
             $this->botActionsSend($lineUserId,$buildActions);
83 91
 
84 92
             //儲存填寫資料
85
-            $survey_data = Survey::where('line_user_id',$lineUserId)->first();
86 93
             if(empty($survey_data->id)){
87 94
                 $survey_data = new Survey();
88 95
             }
@@ -98,7 +105,7 @@ class HealthyPassPortController extends Controller
98 105
     }
99 106
 
100 107
     function buildActionsRequest($type, $values, $groupId = null, $paramName = ""){
101
-        if($type == "addTag"){
108
+        if($type == "addTag" || $type == "removeTag"){
102 109
             if(is_array($values)){
103 110
                 $tags = $values;
104 111
             }else{