hasMany(ActGood::class,'actCode','actCode') ->where(['is_del'=>0]) ->with(['platformYz'=>["good"=>['unit','brand','category'],"platform"]]); } public static function onAfterUpdate(Model $model) : void{ if($model->version=='2.0' && $model->is_del==0 && $model->status==4){ self::sysncAct($model->actCode,$model->status,$model->version); } } public static function sysncAct($actCode,$actStatus,$version){ $list=ActGood::where(['version'=>$version,'actCode'=>$actCode,'is_del'=>0,'status'=>6])->select(); if(!$list->isEmpty()){ ActGood::where(['version'=>$version,'actCode'=>$actCode,'is_del'=>0,'status'=>6])->update(['status'=>3]); } } }