init: 项目初始代码
This commit is contained in:
61
app/api/validate/Advertisement.php
Normal file
61
app/api/validate/Advertisement.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
namespace app\api\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 广告验证器
|
||||
* Class Advertisement
|
||||
* @package app\api\validate
|
||||
*/
|
||||
class Advertisement 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'],
|
||||
'sort|排序' => ['between:1,255'],
|
||||
'advertise_space_id|广告位' => ['integer','gt:0','require'],
|
||||
'image|图片上传' => ['length:1,128','require'],
|
||||
'url|关联链接' => ['length:1,128'],
|
||||
'command|悬浮提示' => ['length:1,128'],
|
||||
'start_time|开始时间' => ['integer','gt:0'],
|
||||
'stop_time|结束时间' => ['integer','gt:0'],
|
||||
'play_order|轮播顺序' => ['integer','gt:0'],
|
||||
'status|状态' => ['in:0,1','integer'],
|
||||
'avatar|广告图' => [
|
||||
'fileSize' => 1024 * 1024 * 5,
|
||||
'fileExt' => 'jpg,png,bmp,gif,jpeg',
|
||||
'fileMime' => 'image/jpeg,image/png,image/gif'
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义错误信息
|
||||
* 格式:'字段名.规则名' => '错误信息'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [];
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
'index' => ['page','size'],
|
||||
'read' => ['id'],
|
||||
'create' => ['site_id','advertise_space_id','name','image','url','play_order','command'],
|
||||
'update' => ['id','advertise_space_id','name','image','url','play_order','command','status'],
|
||||
'del' => ['id'],
|
||||
'upload' => ['']
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user