feat: 新增文章分类增/删/改/查接口

This commit is contained in:
2025-01-04 18:09:26 +08:00
parent 046960030e
commit b28baca77c
15 changed files with 473 additions and 5 deletions

View File

@@ -0,0 +1,50 @@
<?php
declare (strict_types = 1);
namespace app\admin\model\v1;
use think\Model;
use think\model\concern\SoftDelete;
/**
* @mixin \think\Model
*/
class ArticleCategoryModel extends Model
{
// 启动软删除
use SoftDelete;
// 软删除标记数据字段
protected $deleteTime = 'deleted_at';
// 表名
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',
];
// 搜索分类名
public function searchNameAttr($query, $value, $data)
{
$query->where('name', 'like', '%' . $value . '%');
}
}