提现金额限制及添加其它技术

This commit is contained in:
Dev
2026-09-23 17:52:36 +08:00
parent eb5acfc466
commit a07c495fe0
5 changed files with 69 additions and 13 deletions
@@ -67,15 +67,19 @@ class Account extends Api
$user_id = $this->auth->id ?? -1;
$amount = $this->request->post('amount', 0);
$name = $this->request->post('name', '');
// 验证参数
// 验证参数(单笔 0.1~200 元,与 AccountWithdrawService 中的限制保持一致)
$error = $this->validate($this->request->post(), [
'name' => 'require',
'amount' => 'require|number|between:1,500',
'amount' => 'require|number|float|between:'
. AccountWithdrawService::WITHDRAW_MIN_AMOUNT . ','
. AccountWithdrawService::WITHDRAW_MAX_AMOUNT,
], [
'name.require' => '微信真实姓名必填',
'amount.require' => '提现金额不正确',
'amount.number' => '提现金额必须为数字',
'amount.between' => '提现金额必须在1到500之间',
'amount.float' => '提现金额必须为数字',
'amount.between' => '单笔提现金额需在' . AccountWithdrawService::WITHDRAW_MIN_AMOUNT . '~'
. AccountWithdrawService::WITHDRAW_MAX_AMOUNT . '元之间',
]);
if (true !== $error) {
throw new \Exception($error);