From f4edac6ef57d57dff3ac81c7bc28621e6ef10df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Wed, 7 Jan 2026 14:39:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E5=B8=815=E5=88=86=E9=92=9F=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/UserWallet.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/application/api/model/UserWallet.php b/application/api/model/UserWallet.php index 44f68dd5..815c04dc 100644 --- a/application/api/model/UserWallet.php +++ b/application/api/model/UserWallet.php @@ -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; } + } \ No newline at end of file