init: 项目初始代码
This commit is contained in:
47
app/api/validate/GoodsCoupon.php
Normal file
47
app/api/validate/GoodsCoupon.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
namespace app\api\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 优惠
|
||||
* Class GoodsCoupon
|
||||
* @package app\api\validate
|
||||
*/
|
||||
class GoodsCoupon 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'],
|
||||
// 'old_code|旧口令' => ['length:1,30'],
|
||||
'new_code|新口令' => ['require','length:1,30','unique:goods_coupon,new_code^old_code^id'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义错误信息
|
||||
* 格式:'字段名.规则名' => '错误信息'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [];
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
'index' => ['page','size'],
|
||||
'read' => ['id'],
|
||||
'create' => ['site_id','old_code','new_code'],
|
||||
'update' => ['id','old_code','new_code'],
|
||||
'del' => ['id'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user