chore: 重写初始提交(清空历史,整理后全量提交)
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | YwxApp [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: ywxapp<admin@ywxapp.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace ywxapp\model;
|
||||
use ywxapp\model\BaseModel;
|
||||
|
||||
/*
|
||||
* 会员积分日志
|
||||
*/
|
||||
/**
|
||||
* ScoreLog 类
|
||||
*
|
||||
* @author ywxapp <admin@ywxapp.cn>
|
||||
*/
|
||||
class ScoreLog extends BaseModel
|
||||
{
|
||||
protected function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
BaseModel::ensureTableFromInstall(BaseModel::currentPrefix(), 'score_log');
|
||||
}
|
||||
|
||||
protected function getOptions(): array
|
||||
{
|
||||
return [
|
||||
'strict' => false,
|
||||
'name' => 'score_log',
|
||||
'autoWriteTimestamp' => 'int',
|
||||
'createTime' => 'create_at',
|
||||
'updateTime' => 'update_at',
|
||||
// 'deleteTime' => 'delete_at',
|
||||
// 'defaultSoftDelete' => 0,
|
||||
// 'dateFormat' => 'Y-m-d H:i:s',
|
||||
'append' => ['is_parent'],
|
||||
'hidden' => ['password', 'create_at', 'update_at', 'delete_at'],
|
||||
'readonly' => ['id'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 表结构自愈:建表 + 关键列兜底(install.sql 为事实源)。
|
||||
* 查询/写入前调用,避免老库缺表导致 1146。
|
||||
*/
|
||||
public static function ensureSchema(): void
|
||||
{
|
||||
BaseModel::ensureTableFromInstall(BaseModel::currentPrefix(), 'score_log');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user