'bigint',// 'fzCode' =>'varchar',//封账编号 'company_code' =>'varchar',//业务公司编号 'company_name' =>'varchar',//业务公司名称 'fz_date' =>'varchar',//封账月份 'remark' =>'varchar', 'status' =>'tinyint',// 'apply_id' =>'int',// 'apply_name' =>'varchar',// 'update_name' =>'varchar',// 'create_time' =>'datetime',// 'update_time' =>'datetime',// ]; protected $createTime = 'create_time'; protected $updateTime = 'update_time'; public static function onAfterUpdate(Model $model): void { $change = $model->getChangedData(); $origin = $model->getOrigin(); if (isset($change['status']) && $change['status'] == 2 && $origin['status'] == 1) { $fz_date = date('Y-m',strtotime('+1 month',strtotime($model['fz_date']))); $ist =self::where([['fz_date','=',$fz_date],['company_code','=',$model['company_code']]])->findOrEmpty(); if($ist->isEmpty()){ $fzInfo = [ "fzCode"=>makeNo("CWFZ"), 'company_code'=>$model['company_code'], 'company_name'=>$model['company_name'], 'fz_date'=>$fz_date, 'status'=>0, 'remark'=>'', ]; (new ProductFz)->create($fzInfo); } } } }