Browse Source

客户批量打标签 调试

shensong00 1 month ago
parent
commit
8862de7bd6
1 changed files with 12 additions and 4 deletions
  1. 12 4
      app/Console/Commands/CorpInformation/BatchMarkTagNew.php

+ 12 - 4
app/Console/Commands/CorpInformation/BatchMarkTagNew.php

219
                     $userFilterCustomerList = $newFilterCustomerList[$userId]['list'] ?? [];
219
                     $userFilterCustomerList = $newFilterCustomerList[$userId]['list'] ?? [];
220
                     Log::logInfo('待过滤客户列表', ['user_id' => $userId, 'customer_list' => $userFilterCustomerList], $this->logName);
220
                     Log::logInfo('待过滤客户列表', ['user_id' => $userId, 'customer_list' => $userFilterCustomerList], $this->logName);
221
                     if (!empty($userFilterCustomerList)) {
221
                     if (!empty($userFilterCustomerList)) {
222
-                        $customerIdList = array_column($customerList->toArray(), 'customer_id');
223
-                        $newCustomerIdList = array_diff($customerIdList, $userFilterCustomerList);
224
-                        $newCustomerList = $customerList->whereIn('customer_id', $newCustomerIdList)->all();
225
-                        $newCustomerList = json_decode(json_encode($newCustomerList), 1);
222
+                        $newCustomerList = $this->filterCustomerList($customerList->toArray(), $userFilterCustomerList);
226
                     } else {
223
                     } else {
227
                         $newCustomerList = $customerList->toArray();
224
                         $newCustomerList = $customerList->toArray();
228
                     }
225
                     }
246
             } while ($count == $limit);
243
             } while ($count == $limit);
247
         }
244
         }
248
     }
245
     }
246
+
247
+    private function filterCustomerList($customerList, $userFilterCustomerList) {
248
+        $data = [];
249
+        foreach ($customerList as $customerInfo) {
250
+            if(!in_array($customerInfo['customer_id'], $userFilterCustomerList)) {
251
+                $data[] = $customerInfo;
252
+            }
253
+        }
254
+
255
+        return $data;
256
+    }
249
 }
257
 }