提现规则优化

This commit is contained in:
Dev
2026-09-23 14:30:46 +08:00
parent 5db3a4137a
commit 5cc504bb44
6 changed files with 214 additions and 1 deletions
@@ -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){