init: 项目初始代码
This commit is contained in:
52
app/api/validate/BulkBuy.php
Normal file
52
app/api/validate/BulkBuy.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace app\api\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 大批量采购验证器
|
||||
* Class BulkBuy
|
||||
* @package app\api\validate
|
||||
*/
|
||||
class BulkBuy extends Validate
|
||||
{
|
||||
/**
|
||||
* 定义验证规则
|
||||
* 格式:'字段名' => ['规则1','规则2'...]
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => ['require','integer','gt:0'],
|
||||
'page' => ['integer','gt:0'],
|
||||
'size' => ['integer','gt:0'],
|
||||
'site_id|语言包ID' => ['integer','gt:0'],
|
||||
'name|客户名称' => ['length:1,30','require'],
|
||||
'sort|排序' => ['require','between:1,255'],
|
||||
'mode_number|产品型号' => ['length:1,128','require'],
|
||||
'needed_num|需要数量' => ['integer','gt:0'],
|
||||
'email|邮箱' => ['length:1,60','require'],
|
||||
'arrival_country|收货国家'=> ['length:1,128','require'],
|
||||
'delivery_time|发货时间' => ['integer','gt:0'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义错误信息
|
||||
* 格式:'字段名.规则名' => '错误信息'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [];
|
||||
|
||||
/**
|
||||
* 场景
|
||||
* @var
|
||||
*/
|
||||
protected $scene = [
|
||||
'index' => ['page','size'],
|
||||
'read' => ['id'],
|
||||
'create' => ['site_id','name','mode_number','needed_num','email','arrival_country','sort','delivery_time'],
|
||||
'update' => ['id','name','mode_number','needed_num','email','arrival_country','sort','delivery_time'],
|
||||
'del' => ['id'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user