Browse Source

修复提现金额大于余额的问题

master
lanzu_qinsheng 5 years ago
parent
commit
c71eb48006
  1. 2
      app/Admin/Controllers/LanzuCsWithdrawController.php
  2. 7
      app/Models/LanzuUserBalance.php

2
app/Admin/Controllers/LanzuCsWithdrawController.php

@ -101,7 +101,7 @@ class LanzuCsWithdrawController extends AdminController
if ($form->money < env('MIN_MONEY') || $form->money > env('MAX_MONEY')) {
return $form->error('申请提现金额不得小于 ' . env('MIN_MONEY') . ' 元 或 不得大于 ' . env('MAX_MONEY') . ' 元.');
}
$res = LanzuUserBalance::checkBalance($user->id, $form->money);
$res = LanzuUserBalance::checkBalance($user->id, $form->money, Type::BALANCE_USER_TYPE_CS);
if (!$res) {
return $form->error('您可提现金额不足!');
}

7
app/Models/LanzuUserBalance.php

@ -69,9 +69,12 @@ class LanzuUserBalance extends Model
/**
* 校验是否在足够的可提现金额
*/
public static function checkBalance($aduid,$money)
public static function checkBalance($aduid,$money,$type)
{
return self::where('source_id',$aduid)->where('balance','>=',$money)->count();
return self::where('source_id',$aduid)
->where('balance','>=',$money)
->where('user_type',$type)
->count();
}
}
Loading…
Cancel
Save