浏览代码

客户批量打标签 调试

shensong00 1 周之前
父节点
当前提交
8393664af2
共有 1 个文件被更改,包括 12 次插入27 次删除
  1. 12 27
      app/Console/Commands/CorpInformation/BatchMarkTagNew.php

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

@@ -214,29 +214,25 @@ class BatchMarkTagNew extends Command
214 214
                 if($count > 0) {
215 215
                     $customerList = $customerQuery->selectRaw("customer_id, external_userid")
216 216
                         ->offset(($page - 1) * $limit)->limit($limit)->get();
217
-                    Log::logInfo('初始客户列表', ['user_id' => $userId, 'customer_list' => $customerList->toArray()], $this->logName);
218 217
 
219 218
                     $userFilterCustomerList = $newFilterCustomerList[$userId]['list'][0] ?? [];
220
-                    Log::logInfo('待过滤客户列表', ['user_id' => $userId, 'customer_list' => $userFilterCustomerList], $this->logName);
221 219
                     if (!empty($userFilterCustomerList)) {
222
-//                        $newCustomerList = $this->filterCustomerList($customerList->toArray(), $userFilterCustomerList);
223 220
                         $newCustomerList = $customerList->whereNotIn('customer_id', $userFilterCustomerList)->all();
224 221
                     } else {
225 222
                         $newCustomerList = $customerList->all();
226 223
                     }
227
-                    Log::logInfo('过滤后客户列表', ['user_id' => $userId, 'customer_list' => json_decode(json_encode($newCustomerList),1)], $this->logName);
228
-
229
-//                $userExternalUserIdList = array_column($newCustomerList, 'external_userid');
230
-//                $externalUserIdArr = array_chunk($userExternalUserIdList, $this->limit);
231
-//                foreach ($externalUserIdArr as $externalUserIdList) {
232
-//                    $result = BatchMarkTagRecord::savedData($taskInfo['id'], $taskInfo['corpid'], $userId, $externalUserIdList);
233
-//
234
-//                    if (!$result) {
235
-//                        Log::logError('记录写入失败', ['task_info' => $taskInfo], $this->logName);
236
-//                    } else {
237
-//                        RedisModel::rPush(BatchMarkTagRecord::BATCH_MARK_TAG_RECORD, $result->id);
238
-//                    }
239
-//                }
224
+
225
+                    $userExternalUserIdList = array_column($newCustomerList, 'external_userid');
226
+                    $externalUserIdArr = array_chunk($userExternalUserIdList, $this->limit);
227
+                    foreach ($externalUserIdArr as $externalUserIdList) {
228
+                        $result = BatchMarkTagRecord::savedData($taskInfo['id'], $taskInfo['corpid'], $userId, $externalUserIdList);
229
+
230
+                        if (!$result) {
231
+                            Log::logError('记录写入失败', ['task_info' => $taskInfo], $this->logName);
232
+                        } else {
233
+                            RedisModel::rPush(BatchMarkTagRecord::BATCH_MARK_TAG_RECORD, $result->id);
234
+                        }
235
+                    }
240 236
                 }
241 237
 
242 238
 
@@ -244,15 +240,4 @@ class BatchMarkTagNew extends Command
244 240
             } while ($count == $limit);
245 241
         }
246 242
     }
247
-
248
-    private function filterCustomerList($customerList, $userFilterCustomerList) {
249
-        $data = [];
250
-        foreach ($customerList as $customerInfo) {
251
-            if(!in_array($customerInfo['customer_id'], $userFilterCustomerList)) {
252
-                $data[] = $customerInfo;
253
-            }
254
-        }
255
-
256
-        return $data;
257
-    }
258 243
 }