init: 项目初始代码
This commit is contained in:
48
app/api/validate/AdvertisePage.php
Normal file
48
app/api/validate/AdvertisePage.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?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'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user