$event['data']['id']??[]])->field("id cat_id,fund_code,status,is_del,creater apply_name,createrid apply_id,addtime,updatetime")->select(); if($info->isEmpty())return; $plat = Platform::where(['platform_type' => 1, 'is_del' => 0])->field("id")->select(); if(!$plat->isEmpty()){ $data = []; foreach ($info as $item){ $temp= array_map(function($v)use($item){ $item['platform_id'] = $v['id']; return $item; },$plat); $data = array_merge($data,$temp); } $this->save($data); } } protected function save($data){ if(!empty($data)){ $model = new \app\admin\model\CatPlat(); try{ $model->saveAll($data); }catch(\Exception $e){ throw new \Exception($e->getMessage()); } } } }