49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
namespace app\api\validate;
|
|
|
|
use think\Validate;
|
|
|
|
/**
|
|
* 广告页归属验证器
|
|
* Class AdvertisePage
|
|
* @package app\api\validate
|
|
*/
|
|
class AdvertisePage extends Validate
|
|
{
|
|
/**
|
|
* 定义验证规则
|
|
* 格式:'字段名' => ['规则1','规则2'...]
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $rule = [
|
|
'id' => ['require','integer','gt:0'],
|
|
'page' => ['integer','gt:0'],
|
|
'size' => ['integer','gt:0'],
|
|
'site_id|语言包' => ['integer','gt:0'],
|
|
'name|广告页名称' => ['length:1,30','require','unique:advertise_page,name^site_id^platform_id'],
|
|
'sort|排序' => ['between:1,255'],
|
|
];
|
|
|
|
/**
|
|
* 定义错误信息
|
|
* 格式:'字段名.规则名' => '错误信息'
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $message = [];
|
|
|
|
|
|
/**
|
|
* @var
|
|
*/
|
|
protected $scene = [
|
|
'index' => [''],
|
|
'create' => ['site_id','name'],
|
|
'update' => ['id','name'],
|
|
'batchCreate' => ['site_id','name'],
|
|
'batchUpdate' => ['id','name'],
|
|
'del' => ['id'],
|
|
];
|
|
}
|