data_center/app/common/validate/user/UserBalanceValidate.php

57 lines
1.9 KiB
PHP
Raw Normal View History

2023-09-18 17:04:42 +08:00
<?php
namespace app\common\validate\user;
use app\common\validate\BaseValidate;
class UserBalanceValidate extends BaseValidate
{
protected $rule = [
'id' => 'require',
'record_id' => 'require',
'record_table' => 'require',
'amount' => 'require|float|gt:0',
'type' => 'require|in:0,1',
'pay_type' => 'require|in:0,1,2,3,4',
2023-09-18 17:04:42 +08:00
'mark' => 'require',
'uid' => 'require',
'page_no' => 'require|number|gt:0',
'page_size' => 'require|number|gt:0'
2023-09-18 17:04:42 +08:00
];
protected $message = [
'id.require' => '缺少数据主键',
'record_id.require' => '请填写本地记录id',
'record_table.require' => '请填写本地记录表名',
'amount.require' => '请填写金额',
'amount.float' => '金额数据格式错误',
'amount.gt' => '金额必须大于零',
'type.require' => '请选择金额变更类型',
'type.in' => '金额变更类型值错误',
'pay_type.require' => '请选择支付方式',
'pay_type.in' => '支付方式值错误',
'mark.require' => '请填写金额变更具体详情',
'uid.require' => '缺少用户id',
'page_no.require' => '缺少分页页码',
'page_no.number' => '分页页码数据格式错误',
'page_no.gt' => '分页页码必须大于0',
'page_size.require' => '缺少分页条数',
'page_size.number' => '分页条数数据格式错误',
'page_size.gt' => '分页条数必须大于0',
2023-09-18 17:04:42 +08:00
];
public function sceneList(): UserBalanceValidate
{
return $this->only(['uid','page_no','page_size']);
}
2023-09-18 17:04:42 +08:00
public function sceneAdd(): UserBalanceValidate
{
2023-09-19 14:07:28 +08:00
return $this->only(['record_id','record_table','amount','type','pay_type','mark']);
2023-09-18 17:04:42 +08:00
}
public function sceneDetail(): UserBalanceValidate
{
return $this->only(['id']);
}
}