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

39 lines
1.1 KiB
PHP

<?php
namespace app\common\validate\user;
use app\common\validate\BaseValidate;
class UserIntegralValidate extends BaseValidate
{
protected $rule = [
'id' => 'require',
'record_id' => 'require',
'record_table' => 'require',
'amount' => 'require|float|gt:0',
'type' => 'require|in:0,1',
'mark' => 'require',
];
protected $message = [
'id.require' => '缺少数据主键',
'record_id.require' => '请填写本地记录id',
'record_table.require' => '请填写本地记录表名',
'amount.require' => '请填写金额',
'amount.float' => '金额数据格式错误',
'amount.gt' => '金额必须大于零',
'type.require' => '请选择金额变更类型',
'type.in' => '金额变更类型值错误',
'mark.require' => '请填写金额变更具体详情',
];
public function sceneAdd(): UserIntegralValidate
{
return $this->only(['record_id','record_table','amount','type','mark']);
}
public function sceneDetail(): UserIntegralValidate
{
return $this->only(['id']);
}
}