// +---------------------------------------------------------------------- declare(strict_types=1); namespace ywxapp\model; use ywxapp\model\BaseModel; class AddonModel extends BaseModel { // -- 插件主表 // CREATE TABLE `addon` ( // `id` int unsigned AUTO_INCREMENT PRIMARY KEY, // `name` varchar(50) NOT NULL COMMENT '标识符', // `title` varchar(100) NOT NULL COMMENT '名称', // `version` varchar(20) NOT NULL COMMENT '版本号', // `price` decimal(10,2) NOT NULL COMMENT '价格', // `file_path` varchar(255) NOT NULL COMMENT '存储路径(非公开)', // `file_hash` varchar(64) NOT NULL COMMENT 'SHA256校验值', // `status` tinyint DEFAULT 1 COMMENT '1上架 0下架' // ); protected function getOptions(): array { return [ 'strict' => true, 'name' => 'addon', 'autoWriteTimestamp' => 'int', 'createTime' => 'create_at', 'updateTime' => 'update_at', 'schema' => [ 'id' => 'int', 'name' => 'string', 'title' => 'string', 'version' => 'string', 'price' => 'float', 'description' => 'string', 'author' => 'string', 'status' => 'tinyint', 'config' => 'text', 'file_path' => 'string', 'file_hash' => 'string', 'sort' => 'int', 'create_at' => 'int', 'update_at' => 'int', ] ]; } // // 获取已安装插件列表 // public function getInstalledaddon(): array // { // return $this->where('status', '<>', self::STATUS_DISABLE)->order('create_at', 'desc')->select()->toArray(); // } // // 检查插件是否已安装 // public function isInstalled(string $name): bool // { // return $this->where('name', $name)->count() > 0; // } }