init: 项目初始代码
This commit is contained in:
52
app/api/validate/AdvertiseSpace.php
Normal file
52
app/api/validate/AdvertiseSpace.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace app\api\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 广告位验证器
|
||||
* Class AdvertiseSpace
|
||||
* @package app\api\validate
|
||||
*/
|
||||
class AdvertiseSpace 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,50','require','unique:advertise_space,name^site_id^platform_id'],
|
||||
'sort|排序' => ['between:1,255'],
|
||||
'advertise_page_id|所属页面'=>['integer','gt:0'],
|
||||
'max_num|数量上限' => ['integer','between:1,15'],
|
||||
'width|尺寸要求-宽度' => ['integer','gt:0','elt:1920'],
|
||||
'height|尺寸要求-高度' => ['integer','gt:0','elt:1920'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义错误信息
|
||||
* 格式:'字段名.规则名' => '错误信息'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [];
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
'index' => ['page','size','advertise_page_id'],
|
||||
'read' => ['id'],
|
||||
'create' => ['site_id','advertise_page_id','name','max_num','width','height','sort'],
|
||||
'update' => ['id','advertise_page_id','name','max_num','width','height','sort'],
|
||||
'del' => ['id'],
|
||||
'invalidList' => ['']
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user