父节点
当前提交
b3a10501c7
共有 1 个文件被更改,包括 9 次插入2 次删除
  1. 9
    2
      src/be/app/Http/Controllers/HealthyPassPortController.php

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

61
                                 "healthAge" => $healthAge,
61
                                 "healthAge" => $healthAge,
62
                                 "healthGender" => $healthGender,
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
         //準備將填寫內容過API寫入 botbonnie 後台
73
         //準備將填寫內容過API寫入 botbonnie 後台
66
         $buildActions = [];
74
         $buildActions = [];
82
             $this->botActionsSend($lineUserId,$buildActions);
90
             $this->botActionsSend($lineUserId,$buildActions);
83
 
91
 
84
             //儲存填寫資料
92
             //儲存填寫資料
85
-            $survey_data = Survey::where('line_user_id',$lineUserId)->first();
86
             if(empty($survey_data->id)){
93
             if(empty($survey_data->id)){
87
                 $survey_data = new Survey();
94
                 $survey_data = new Survey();
88
             }
95
             }
98
     }
105
     }
99
 
106
 
100
     function buildActionsRequest($type, $values, $groupId = null, $paramName = ""){
107
     function buildActionsRequest($type, $values, $groupId = null, $paramName = ""){
101
-        if($type == "addTag"){
108
+        if($type == "addTag" || $type == "removeTag"){
102
             if(is_array($values)){
109
             if(is_array($values)){
103
                 $tags = $values;
110
                 $tags = $values;
104
             }else{
111
             }else{