测试:- 爵位续费限制问题处理

This commit is contained in:
2025-12-04 15:29:48 +08:00
parent 550b1e4fd9
commit 584b86048c

View File

@@ -148,6 +148,7 @@ class Nobility extends Model
$user_nobility_info = db::name('vs_user_nobility')
->field('id,user_id,lid,end_time')
->where('delete_time', 0)
->where(['end_time'=>['>',time()]])
->where('user_id', $user_id)
->find();
if ($user_nobility_info) { //已购买过 续费
@@ -160,7 +161,7 @@ class Nobility extends Model
}
$end_time = $old_end_time + $nobility_info['day'] * 86400;
//判断是否可以续费
$end_time_to_day = floor($end_time / 86400);
$end_time_to_day = floor(($end_time - time()) / 86400);
if($end_time_to_day > $nobility_info['day'] * 2){
return ['code' => 0, 'msg' => '已超过2倍有效期,无序续费', 'data' => null];
}
@@ -273,7 +274,7 @@ class Nobility extends Model
$price = $nobility_info['renew_price'];
$end_time = $user_nobility_info['end_time'] + $nobility_info['day'] * 86400;
//判断是否可以续费
$end_time_to_day = floor($end_time / 86400);
$end_time_to_day = floor(($end_time - time()) / 86400);
if($end_time_to_day > $nobility_info['day'] * 2){
return ['code' => 0, 'msg' => '已超过2倍有效期,无序续费', 'data' => null];
}