refactor: 修改model

This commit is contained in:
2025-01-13 09:28:15 +08:00
parent f82ac85b46
commit 2e3eba644e
15 changed files with 231 additions and 143 deletions

View File

@@ -0,0 +1,43 @@
<?php
declare (strict_types = 1);
namespace app\common\model;
use think\Model;
/**
* @mixin \think\Model
*/
class ArticleBaseModel extends Model
{
// 表名
protected $name = 'article';
// 主键
protected $pk = 'id';
// 字段信息
protected $schema = [
'id' => 'int',
'language_id' => 'int',
'category_id' => 'int',
'title' => 'string',
'author' => 'string',
'source' => 'string',
'image' => 'string',
'desc' => 'string',
'recommend' => 'int',
'release_time' => 'int',
'sort' => 'int',
'link' => 'string',
'content' => 'string',
'view_count' => 'int',
'praise_count' => 'int',
'seo_title' => 'string',
'seo_keywords' => 'string',
'seo_desc' => 'string',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
];
}

View File

@@ -0,0 +1,38 @@
<?php
declare (strict_types = 1);
namespace app\common\model;
use think\Model;
/**
* @mixin \think\Model
*/
class ArticleCategoryBaseModel extends Model
{
// 表名
protected $name = 'article_category';
// 主键
protected $pk = 'id';
// 字段信息
protected $schema = [
'id' => 'int',
'language_id' => 'int',
'pid' => 'int',
'name' => 'string',
'short_name' => 'string',
'icon' => 'string',
'desc' => 'string',
'sort' => 'int',
'level' => 'int',
'is_show' => 'int',
'seo_title' => 'string',
'seo_keywords' => 'string',
'seo_desc' => 'string',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
];
}

View File

@@ -0,0 +1,30 @@
<?php
declare (strict_types = 1);
namespace app\common\model;
use think\Model;
/**
* @mixin \think\Model
*/
class CountryBaseModel extends Model
{
// 表名
protected $name = 'sys_country';
// 主键
protected $pk = 'id';
// 字段信息
protected $schema = [
'id' => 'int',
'name' => 'string',
'code' => 'string',
'icon' => 'string',
'status' => 'int',
'sort' => 'int',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
}

View File

@@ -0,0 +1,33 @@
<?php
declare (strict_types = 1);
namespace app\common\model;
use think\Model;
/**
* @mixin \think\Model
*/
class LanguageBaseModel extends Model
{
// 表名
protected $name = 'sys_language';
// 主键
protected $pk = 'id';
// 字段信息
protected $schema = [
'id' => 'int',
'country_id' => 'int',
'name' => 'string',
'code' => 'string',
'icon' => 'string',
'url' => 'string',
'status' => 'int',
'is_default' => 'int',
'sort' => 'int',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
}

View File

@@ -0,0 +1,34 @@
<?php
declare (strict_types = 1);
namespace app\common\model;
use think\Model;
/**
* @mixin \think\Model
*/
class UserBaseModel extends Model
{
// 表名
protected $name = 'sys_user';
// 主键
protected $pk = 'id';
// 字段信息
protected $schema = [
'id' => 'int',
'username' => 'string',
'password' => 'string',
'salt' => 'string',
'role_id' => 'int',
'nickname' => 'string',
'avatar' => 'string',
'mobile' => 'string',
'email' => 'string',
'status' => 'int',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
}

View File

@@ -0,0 +1,29 @@
<?php
declare (strict_types = 1);
namespace app\common\model;
use think\Model;
/**
* @mixin \think\Model
*/
class UserLoginLogBaseModel extends Model
{
// 表名
protected $name = 'sys_user_login_log';
// 主键
protected $pk = 'id';
// 字段信息
protected $schema = [
'id' => 'int',
'user_id' => 'int',
'ip' => 'string',
'user_agent' => 'string',
'message' => 'string',
'status' => 'int',
'created_at' => 'datetime',
];
}