转币5分钟限制

This commit is contained in:
2026-01-07 14:39:24 +08:00
parent fb9963d49f
commit f4edac6ef5

View File

@@ -124,10 +124,11 @@ class UserWallet extends Model
$exchange_user = Cache::get('exchange_user_' . $uid);
if($exchange_user){
//获取缓存的过期剩余 时间
$time = Cache::store('redis')->handler()->ttl('exchange_user_' . $uid);
return ['code' => 0, 'msg' => '请'.$time.'后再次兑换', 'data' => null];
$time = ceil((Cache::get('exchange_user_end_time_' . $uid) - time() ) /60);
return ['code' => 0, 'msg' => '请'.$time.'分钟后再次兑换', 'data' => null];
}else{
Cache::set('exchange_user_' . $uid, 1, 5 * 60);
Cache::set('exchange_user_end_time_' . $uid, time() + 5 * 60 , 5 * 60 + 1);
}
if(empty($earnings_num)){
return ['code' => 0, 'msg' => '请输入需要兑换的钻石数量', 'data' => null];
@@ -339,4 +340,5 @@ class UserWallet extends Model
return true;
}
}