You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.3 KiB
61 lines
1.3 KiB
<?php
|
|
declare (strict_types=1);
|
|
|
|
namespace app\api\validate;
|
|
|
|
use think\facade\Db;
|
|
use think\Validate;
|
|
|
|
class Cate extends Validate
|
|
{
|
|
/**
|
|
* 定义验证规则
|
|
* 格式:'字段名' => ['规则1','规则2'...]
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $rule = [
|
|
'en_name|栏目英文名' => "require|uniqueSite:bmz_cate|length:1,50",
|
|
'cate_name|栏目名称' => 'require|length:1,100',
|
|
];
|
|
|
|
/**
|
|
* 定义错误信息
|
|
* 格式:'字段名.规则名' => '错误信息'
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $message = [
|
|
'en_name.require' => '请输入栏目英文名称',
|
|
'en_name.length' => '栏目英文名称必需在1~50位之间',
|
|
'en_name.uniqueSite' => '英文名称已存在',
|
|
'cate_name.require' => '请输入栏目名称',
|
|
'cate_name.length' => '栏目名称必需在1~50位之间',
|
|
];
|
|
|
|
/**
|
|
* 验证场景规则
|
|
* @var array
|
|
*/
|
|
protected $scene = [
|
|
'read' => ['id'],
|
|
];
|
|
|
|
/**
|
|
* 修改场景验证
|
|
* @return Manager
|
|
*/
|
|
public function sceneUpdate()
|
|
{
|
|
|
|
}
|
|
|
|
/**
|
|
* 自定义查询场景验证 可灵活设置验证字段
|
|
* @return Manager
|
|
*/
|
|
public function sceneLists()
|
|
{
|
|
|
|
}
|
|
}
|
|
|