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