feat: 添加站点配置/配置项分页/配置项详情/配置项新增/配置项更新/配置项删除接口/站点配置项
接口/站点配置项更新接口/配置项类型接口/配置项分组接口
This commit is contained in:
56
app/admin/validate/v1/SysConfigValidate.php
Normal file
56
app/admin/validate/v1/SysConfigValidate.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\validate\v1;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class SysConfigValidate extends Validate
|
||||
{
|
||||
/**
|
||||
* 定义验证规则
|
||||
* 格式:'字段名' => ['规则1','规则2'...]
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|integer',
|
||||
'group_id' => 'require|integer',
|
||||
'title' => 'require|max:64',
|
||||
'name' => 'require|unique:sys_config|max:64',
|
||||
'value' => 'max:255',
|
||||
'extra' => 'max:255',
|
||||
'type' => 'max:64',
|
||||
'sort' => 'integer',
|
||||
'remark' => 'max:255'
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义错误信息
|
||||
* 格式:'字段名.规则名' => '错误信息'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'id.require' => 'ID不能为空',
|
||||
'id.integer' => 'ID必须是整数',
|
||||
'group_id.require' => '分组ID不能为空',
|
||||
'group_id.integer' => '分组ID必须是整数',
|
||||
'title.require' => '标题不能为空',
|
||||
'title.max' => '标题最多不能超过64个字符',
|
||||
'name.require' => '标识不能为空',
|
||||
'name.unique' => '标识已存在',
|
||||
'name.max' => '名称最多不能超过64个字符',
|
||||
'value.max' => '值最多不能超过255个字符',
|
||||
'extra.max' => '额外信息最多不能超过255个字符',
|
||||
'type.max' => '类型最多不能超过64个字符',
|
||||
'sort.integer' => '排序必须是整数',
|
||||
'remark.max' => '备注最多不能超过255个字符',
|
||||
];
|
||||
|
||||
// 新增场景
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', 'require|integer');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user