提现规则优化
This commit is contained in:
@@ -42,6 +42,14 @@ class AccountWithdrawService
|
||||
*/
|
||||
public static function applyWithdraw($userId, $amount, string $name = '')
|
||||
{
|
||||
//每个自然日仅可发起一次提现申请
|
||||
$todayCount = self::$Model::where('user_id', $userId)
|
||||
->whereTime('createtime', 'today')
|
||||
->count();
|
||||
if ($todayCount >= 10) {
|
||||
throw new \Exception('每个自然日仅可发起10次提现申请,请明日再试');
|
||||
}
|
||||
|
||||
//开启事务 抛出异常时自动回滚
|
||||
Db::transaction(function () use ($userId, $amount, $name) {
|
||||
if($name){
|
||||
|
||||
Reference in New Issue
Block a user