message_data = $message_data; } /** * Execute the job. * * @return void */ public function handle() { $page = isset($this->message_data['page']) ? $this->message_data['page'] : 1; $limit = isset($this->message_data['limit']) ? $this->message_data['limit'] : 50; $field = [ 'id', //ID 'manufacturer', //公司名称 'drugname', //药品名称 'specification', //规格 'approval', //批准文号 'comStoreId', //供应商(店铺)ID 'storeName', //供应商(店铺)名称 'minPrice', //最低价 'real_crawler_time', //真实采集时间 'url', //药品详情页url ]; try { $YychengProductModel = new YychengProductModel(); //获取分页数据,多个字段进行分组去重 $list_config_data = $YychengProductModel->where([['real_crawler_time', '<', time() - 86400]]) ->orderby('id', 'desc')->paginate($limit, $field, 'page', $page)->toarray(); if (!$list_config_data || empty($list_config_data['data'])) { $totle_data = isset($this->message_data['total']) ? $this->message_data['total'] : 0; Log::info('job_info', '采集数据-医药城数据同步队列,执行完毕', ['data' => ['page' => $page, 'limit' => $limit, 'totle' => $totle_data], 'message' => '没有数据可同步']); return true; } $total = $list_config_data['total']; $request_data['data'] = $list_config_data['data']; $request_data['queue_page'] = $page; $request_data['queue_limit'] = $limit; $request_data['queue_total'] = $total; YychengStoreJobs::dispatch($request_data); // YychengStoreJobs::dispatchSync($request_data); Log::info('job_info', '采集数据-医药城数据同步队列日志', ['data' => ['page' => $page, 'limit' => $limit, 'totle' => $total]]); } catch (\Exception $e) { Log::info('job_error', '采集数据-医药城数据同步队列失败', ['error' => $e->getMessage()]); } } }