message_data = $message_data; } /** * Execute the job. * * @return void */ public function handle() { try { $ViolationStoreModel = new ViolationStoreModel(); $limit = isset($this->message_data['limit']) ? $this->message_data['limit'] : 50; $page = isset($this->message_data['page']) ? $this->message_data['page'] : 1; $executeLog_id = isset($this->message_data['executeLog_id']) ? $this->message_data['executeLog_id'] : 0; $admin_id = isset($this->message_data['admin_id']) ? $this->message_data['admin_id'] : 0; if($page == 1){ $ExecuteLogModel = new ExecuteLogModel(); $insert_data =['name' =>'违规挂网店铺', 'code' => 'ViolationStoreJobs', 'admin_id' => $admin_id]; $executeLog_id=$ExecuteLogModel->addExecuteLog_content($insert_data); } $list_config_data = $ViolationStoreModel->where('status', 0)->where('store_type', 1)->paginate($limit, ['*'], 'page', $page)->toarray(); if (!$list_config_data || empty($list_config_data['data'])) { return true; } $list_data = $list_config_data['data']; foreach ($list_data as $key => $value) { $message_data = [ 'id' => $value['id'], 'platform' => $value['platform'], 'store_name'=> $value['store_name'], 'store_type' => $value['store_type'], 'company_name' => $value['company_name'], 'social_credit_code' => $value['social_credit_code'], 'executeLog_id' => $executeLog_id, ]; ViolationStoreDataJobs::dispatch($message_data); // ViolationStoreDataJobs::dispatchSync($message_data); } $now_message_data = [ 'limit' => $limit, 'page' => $page + 1, 'executeLog_id' => $executeLog_id, ]; ViolationStoreJobs::dispatch($now_message_data); } catch (\Exception $e) { Log::info('job_error', '数据清洗-违规挂网店铺队列失败', ['data' => $this->message_data, 'error' => $e->getMessage()]); } } public function failed(\Throwable $exception) { Log::info('job_error', '数据清洗-违规挂网店铺队列完全失败', ['data' => $this->message_data, 'error' => $exception]); } }