// +---------------------------------------------------------------------- declare(strict_types=1); namespace app\appmall\model; use app\appmall\library\AppmallSchema; use ywxapp\model\BaseModel; /** * 插件审核历史日志(中心站,可视化时间线数据源) * 表:appmall_addon_review_log * @mixin \think\Model */ class AddonReviewLog extends BaseModel { protected function getOptions(): array { return [ 'strict' => true, 'name' => 'appmall_addon_review_log', 'autoWriteTimestamp' => 'int', 'createTime' => 'create_at', 'updateTime' => false, ]; } /** * 表结构自愈:缺表建表(事实源 app/appmall/install.sql)。 */ public static function ensureSchema(): void { AppmallSchema::ensureTable('appmall_addon_review_log'); } /** * 模型一被使用(含静态查询)就先兜底建表,任何入口都不会再撞 1146。 */ protected function initialize() { parent::initialize(); self::ensureSchema(); } /** * 关联审核单(appmall_addon_submissions) * @return \think\model\relation\BelongsTo */ public function submission() { return $this->belongsTo(AddonSubmission::class, 'submission_id', 'id'); } }