瀏覽代碼

(fix): if not remove tag or add tag

oscar 1 年之前
父節點
當前提交
6cd992cb7a
共有 1 個文件被更改,包括 15 次插入5 次删除
  1. 15
    5
      src/be/app/Http/Controllers/HealthyPassPortController.php

+ 15
- 5
src/be/app/Http/Controllers/HealthyPassPortController.php 查看文件

166
             }
166
             }
167
             switch ($action['type']) {
167
             switch ($action['type']) {
168
                 case "addTag":
168
                 case "addTag":
169
-                case "removeTag":
170
                     foreach ($action['value'] as $value) {
169
                     foreach ($action['value'] as $value) {
171
                         $tagType[$action['type']]['value'][] = $value;
170
                         $tagType[$action['type']]['value'][] = $value;
172
                     }
171
                     }
175
             }
174
             }
176
         }
175
         }
177
 
176
 
178
-        $actions = array_merge($actions, [[
179
-            'type' => 'addTag',
180
-            'value' => $tagType['addTag']['value']
181
-        ]]);
177
+        $mergeData = [];
178
+        if (isset($tagType['addTag'])) {
179
+            $mergeData[] = [
180
+                'type' => 'addTag',
181
+                'value' => $tagType['addTag']['value']
182
+            ];
183
+        }
184
+        if (isset($tagType['removeTag'])) {
185
+            $mergeData[] = [
186
+                'type' => 'removeTag',
187
+                'value' => $tagType['removeTag']['value']
188
+            ];
189
+        }
190
+
191
+        $actions = array_merge($actions, $mergeData);
182
 
192
 
183
         $actions = array_values($actions);
193
         $actions = array_values($actions);
184
 
194