feat: 新增文章分类增/删/改/查接口
This commit is contained in:
50
app/admin/model/v1/ArticleCategoryModel.php
Normal file
50
app/admin/model/v1/ArticleCategoryModel.php
Normal 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 . '%');
|
||||
}
|
||||
}
|
||||
43
app/admin/model/v1/ArticleModel.php
Normal file
43
app/admin/model/v1/ArticleModel.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model\v1;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ArticleModel extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'article';
|
||||
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'languge_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',
|
||||
];
|
||||
}
|
||||
30
app/admin/model/v1/CountryModel.php
Normal file
30
app/admin/model/v1/CountryModel.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model\v1;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class CountryModel 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',
|
||||
];
|
||||
}
|
||||
39
app/admin/model/v1/LanguageModel.php
Normal file
39
app/admin/model/v1/LanguageModel.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model\v1;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class LanguageModel 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',
|
||||
];
|
||||
|
||||
// 关联国家
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(CountryModel::class, 'country_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -10,13 +10,13 @@ use think\Model;
|
||||
*/
|
||||
class UserLoginLogModel extends Model
|
||||
{
|
||||
// 设置表名
|
||||
// 表名
|
||||
protected $name = 'sys_user_login_log';
|
||||
|
||||
// 设置主键
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 设置字段信息
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'user_id' => 'int',
|
||||
|
||||
Reference in New Issue
Block a user