|
|
@@ -1220,14 +1220,7 @@ class PayRechargeController extends Controller
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 5. 检查是否已经买过 305 礼包
|
|
|
- $hasBought = DB::table('agent.dbo.order')
|
|
|
- ->where('user_id', $userId)
|
|
|
- ->where('GiftsID', 305)
|
|
|
- ->where('pay_status', 1)
|
|
|
- ->exists();
|
|
|
-
|
|
|
- // 6. 查询 7 日礼包记录状态
|
|
|
+ // 5. 查询最近一条 7 日礼包记录状态(用于判断是否进入新一轮)
|
|
|
$record = DB::table('agent.dbo.inactive_vip_gift_records')
|
|
|
->where('user_id', $userId)
|
|
|
->where('gift_id', 305)
|
|
|
@@ -1245,20 +1238,12 @@ class PayRechargeController extends Controller
|
|
|
$status = 1;
|
|
|
$timeLeft = 0; // 倒计时剩余秒数
|
|
|
|
|
|
- if ($hasBought) {
|
|
|
- if (!$record) {
|
|
|
- $status = 2;
|
|
|
- } else {
|
|
|
- // 检查 7 天礼包是否已过期
|
|
|
- if (strtotime($record->expired_at) < time()) {
|
|
|
- $status = 4; // 7天礼包已过期
|
|
|
- } else {
|
|
|
- // 检查 7 天是否全部领完:claimed_days_mask 的低 7 位全部为 1
|
|
|
- $allClaimedMask = (1 << 7) - 1; // 0b1111111
|
|
|
- $status = (($record->claimed_days_mask & $allClaimedMask) == $allClaimedMask) ? 3 : 2;
|
|
|
- }
|
|
|
- }
|
|
|
+ if ($record && strtotime($record->expired_at) >= time()) {
|
|
|
+ // 当前轮次仍有效:根据领取进度展示状态
|
|
|
+ $allClaimedMask = (1 << 7) - 1; // 0b1111111
|
|
|
+ $status = (($record->claimed_days_mask & $allClaimedMask) == $allClaimedMask) ? 3 : 2;
|
|
|
} else {
|
|
|
+ // 无记录 or 上一轮已过期:可进入新一轮,走未充值倒计时逻辑
|
|
|
// 满足条件但未充值:检查24小时倒计时(每天重置)
|
|
|
$today = date('Y-m-d');
|
|
|
$timerKey = "vip_inactive_gift_timer_{$userId}_{$today}";
|
|
|
@@ -1295,9 +1280,9 @@ class PayRechargeController extends Controller
|
|
|
// 'avg_recharge' => round($avgRecharge, 2),
|
|
|
'time_left' => $timeLeft,
|
|
|
'expire_at' => $timeLeft > 0 ? (time() + $timeLeft) : null,
|
|
|
- 'message' => $status == 1 ? __('web.gift.vip_inactive_can_recharge') :
|
|
|
- ($status == 2 ? __('web.gift.vip_inactive_claimed_partial') :
|
|
|
- ($status == 3 ? __('web.gift.vip_inactive_claimed_all') :
|
|
|
+ 'message' => $status == 1 ? __('web.gift.vip_inactive_can_recharge') :
|
|
|
+ ($status == 2 ? __('web.gift.vip_inactive_claimed_partial') :
|
|
|
+ ($status == 3 ? __('web.gift.vip_inactive_claimed_all') :
|
|
|
__('web.gift.vip_inactive_seven_days_expired')))
|
|
|
];
|
|
|
|