init: 项目初始代码
This commit is contained in:
46
app/api/validate/Currency.php
Normal file
46
app/api/validate/Currency.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace app\api\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Currency extends Validate
|
||||
{
|
||||
/**
|
||||
* 定义验证规则
|
||||
* 格式:'字段名' => ['规则1','规则2'...]
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => ['require','integer'],
|
||||
'page' => ['integer','gt:0'],
|
||||
'size' => ['integer','gt:0'],
|
||||
'name|币种名称' => ['length:1,10','require','unique:currency,name'],
|
||||
'code|币种缩写' => ['length:1,10','require','unique:currency,code'],
|
||||
'signal|币种符号' => ['length:1,10','require'],
|
||||
'status|状态' => ['in:0,1','integer'],
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 定义错误信息
|
||||
* 格式:'字段名.规则名' => '错误信息'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [];
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
'index' => ['page','size'],
|
||||
'read' => ['id'],
|
||||
'create' => ['name','code','signal','status'],
|
||||
'update' => ['id','name','code','signal','status'],
|
||||
'del' => ['id'],
|
||||
'changeStatus'=> ['id','status'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user