// +---------------------------------------------------------------------- declare(strict_types=1); namespace app\appmall\model; use app\appmall\library\AppmallSchema; use ywxapp\model\BaseModel; /** * 接口频率限制(中心站,buy/notify/download/submit 等防刷) * 表:appmall_throttle * @mixin \think\Model */ class Throttle extends BaseModel { protected function getOptions(): array { return [ 'strict' => true, 'name' => 'appmall_throttle', 'autoWriteTimestamp' => 'int', 'createTime' => 'create_at', 'updateTime' => false, ]; } /** * 表结构自愈:缺表建表(事实源 app/appmall/install.sql)。 */ public static function ensureSchema(): void { AppmallSchema::ensureTable('appmall_throttle'); } /** * 模型一被使用(含静态查询)就先兜底建表,任何入口都不会再撞 1146。 */ protected function initialize() { parent::initialize(); self::ensureSchema(); } }