services->rabbitMq->push( RabbitMqEnum::EXCHANGE_ORDER, RabbitMqEnum::TASK_QUEUE, [ 'mall_id' => $this->mall_id, 'region_code' => $region_code, ], RegionImportListener::class, 'async_handle' ); return true; } /** * 任务执行导入 * * @param string $region_code * @return boolean */ public function taskImport($region_code = '') { $list = $this->api->getRegionByCodeOpen($region_code); if (empty($list)) { return true; } $list = array_map(function ($v) { $arr['region_id'] = $v['id']; $arr['name'] = $v['name']; $arr['region_code'] = $v['regionCode']; $arr['parent_code'] = $v['parentCode']; $arr['parent_name'] = $v['parentName']; $arr['region_full_name'] = $v['regionFullName']; $arr['region_full_codes'] = $v['regionFullCodes']; $arr['longitude'] = $v['longitude']; $arr['latitude'] = $v['latitude']; $arr['initial'] = $v['initial']; $arr['region_level'] = $v['regionLevel']; return $arr; }, $list); foreach ($list as $v) { $this->import($v['region_code']); } Region::batchInsert($list, false); } }