创建模型验证器,验证数据正确性
This commit is contained in:
25
app/common/validate/WithdrawOrder.php
Normal file
25
app/common/validate/WithdrawOrder.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class WithdrawOrder extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'order_no' => 'require|max:64|unique:withdraw_order',
|
||||
'user_id' => 'require|integer|gt:0',
|
||||
'amount' => 'float|egt:0',
|
||||
'status' => 'require|in:0,1,2,3',
|
||||
'remark' => 'max:255',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['order_no', 'user_id', 'amount', 'status', 'remark'],
|
||||
'edit' => ['amount', 'status', 'remark'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user