"int", "poster_guid" => "string", "poster_location" => "string", "poster_img" => "string", "poster_title" => "string", "poster_describe" => "string", "poster_sort" => "string", "poster_create_time" => "datetime", "poster_create_user_guid" => "string", "poster_update_time" => "datetime", "poster_update_user_guid" => "string", "poster_delete_time" => "datetime", "poster_delete_user_guid" => "string", ]; // 设置json类型字段 protected $json = ['']; // 开启自动写入时间戳字段 protected $autoWriteTimestamp = 'datetime'; // 创建时间 protected $createTime = 'poster_create_time'; // 修改时间 protected $updateTime = 'poster_update_time'; //排序字段 public $order_field = 'poster_sort'; /** * 新增前 */ public static function onBeforeInsert(self $model): void { Validate::unique(self::class, $model->poster_guid, $model->getData(), [ 'poster_location' => '海报位置', ]); Tool::dataAddSortProc($model); $model->completeCreateField(); } /** * 更新前 */ public static function onBeforeUpdate(self $model): void { Tool::dataEditSortProc($model); $model->completeUpdateField(); } /** * 删除前 */ public static function onBeforeDelete(self $model): void { Tool::dataDeleteSortProc($model); $model->completeDeleteField(); } }