// +---------------------------------------------------------------------- declare(strict_types=1); namespace app\appmall\model; use app\appmall\library\AppmallSchema; use ywxapp\model\BaseModel; /** * 开发者提现单(中心站) * 表:appmall_addon_withdrawals * @mixin \think\Model */ class Withdrawal extends BaseModel { protected function getOptions(): array { return [ 'strict' => true, 'name' => 'appmall_addon_withdrawals', 'autoWriteTimestamp' => 'int', 'createTime' => 'create_at', 'updateTime' => 'update_at', ]; } /** * 表结构自愈:缺表建表(事实源 app/appmall/install.sql)。 */ public static function ensureSchema(): void { AppmallSchema::ensureTable('appmall_addon_withdrawals'); } /** * 模型一被使用(含静态查询)就先兜底建表,任何入口都不会再撞 1146。 */ protected function initialize() { parent::initialize(); self::ensureSchema(); } /** * 关联开发者 * @return \think\model\relation\BelongsTo */ public function developer() { return $this->belongsTo(Developer::class, 'developer_id', 'id'); } }