feat: 添加站点配置/配置项分页/配置项详情/配置项新增/配置项更新/配置项删除接口/站点配置项
接口/站点配置项更新接口/配置项类型接口/配置项分组接口
This commit is contained in:
50
app/admin/model/v1/SysConfigModel.php
Normal file
50
app/admin/model/v1/SysConfigModel.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model\v1;
|
||||
|
||||
use app\common\model\SysConfigBaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
* 系统配置模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class SysConfigModel extends SysConfigBaseModel
|
||||
{
|
||||
// 启用软件删除
|
||||
use SoftDelete;
|
||||
// 软件删除字段
|
||||
protected $deleteTime = 'deleted_at';
|
||||
|
||||
// 关联分组
|
||||
public function group()
|
||||
{
|
||||
return $this->belongsTo('SysConfigGroupModel', 'group_id', 'id');
|
||||
}
|
||||
|
||||
// 关联类型
|
||||
public function type()
|
||||
{
|
||||
return $this->belongsTo('SysConfigTypeModel', 'type', 'value');
|
||||
}
|
||||
|
||||
// 按title搜索
|
||||
public function searchTitleAttr($query, $value, $data)
|
||||
{
|
||||
if (empty($value)) {
|
||||
return;
|
||||
}
|
||||
$query->where('title', 'like', "%{$value}%");
|
||||
}
|
||||
|
||||
// 按group_id查询
|
||||
public function scopeGroupId($query, $value)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
$query->where('group_id', 'in', $value);
|
||||
return;
|
||||
}
|
||||
$query->where('group_id', '=', $value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user