Files
ntonpower/app/api/validate/Site.php
2026-10-14 14:00:29 +08:00

49 lines
1.3 KiB
PHP

<?php
namespace app\api\validate;
use think\Validate;
/**
* 站点验证器
* Class Site
* @package app\api\validate
*/
class Site extends Validate
{
/**
* 定义验证规则
* 格式:'字段名' => ['规则1','规则2'...]
*
* @var array
*/
protected $rule = [
'id' => ['require','integer','gt:0'],
'page' => ['integer','gt:0'],
'size' => ['integer','gt:0'],
'status|状态' => ['in:0,1','integer'],
'currency_id|默认币种' => ['integer','gt:0'],
'language_id|站点语言'=> ['integer','gt:0'],
'platform_id|所属品牌'=> ['integer','gt:0'],
'domain|站点域名' => ['length:1,128','require'],
];
/**
* 定义错误信息
* 格式:'字段名.规则名' => '错误信息'
*
* @var array
*/
protected $message = [];
protected $scene = [
'index' => ['page','size','platform_id'],
'read' => ['id'],
'create' => ['platform_id','language_id','currency_id','domain','status'],
'update' => ['id','platform_id','currency_id','domain','status'],
'del' => ['id'],
'get_nav' => ['id'],
'changeStatus' => ['id','status'],
'siteIndex' => ['']
];
}