refactor: 修改model

This commit is contained in:
2025-01-13 09:28:15 +08:00
parent 355b378301
commit 8cea2c4e56
15 changed files with 231 additions and 143 deletions

View File

@@ -3,50 +3,19 @@ declare (strict_types = 1);
namespace app\admin\model\v1;
use think\Model;
use app\common\model\ArticleBaseModel;
use think\model\concern\SoftDelete;
/**
* @mixin \think\Model
*/
class ArticleModel extends Model
class ArticleModel extends ArticleBaseModel
{
// 启用软件删除
use SoftDelete;
// 软删除标记数据字段
protected $deleteTime = 'deleted_at';
// 表名
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',
];
// 搜索名称
public function searchTitleAttr($query, $value, $data)
{