Просмотр исходного кода

pwa方法
freebonus领取任务3变更

Tree 11 часов назад
Родитель
Сommit
c1372d8bf0
1 измененных файлов с 48 добавлено и 17 удалено
  1. 48 17
      app/Http/Controllers/Game/ActivityController.php

+ 48 - 17
app/Http/Controllers/Game/ActivityController.php

@@ -833,10 +833,20 @@ class ActivityController extends Controller
                 $currentLoopCount = $taskData['stage3_loop_count'] ?? 0;
                 $rewardAmount = ($currentLoopCount == 0) ? 20 : 10;
                 
-                // 领取后刷新任务:充值目标+100,下注目标+1000
-                $newRechargeTarget = $rechargeTarget + 100;
-                $newBetTarget = $betTarget + 1000;
+                // 领取后刷新任务:
+                // - 第二轮及之后每轮目标固定为:再充值100、再下注500
+                // - 记录当前总充值和总流水作为下一轮的基准值,进度只统计“本轮新增”
                 $newLoopCount = $currentLoopCount + 1;
+
+                // 获取最新的总充值和总流水(与 getVipWithdrawTasks 中的统计方式保持一致)
+                $rechargeTotal = DB::table(TableName::QPRecordDB() . 'RecordUserTotalStatistics')
+                    ->where('UserID', $userId)
+                    ->value('Recharge') ?: 0;
+                $totalBetAmount = $taskData['total_bet'] ?? 0;
+
+                // 下一轮目标:固定 100 / 500
+                $newRechargeTarget = 100;
+                $newBetTarget      = 500;
                 
                 // 更新任务数据
                 $redisKey = "vip_withdraw_task_{$userId}";
@@ -844,10 +854,16 @@ class ActivityController extends Controller
                 if ($data) {
                     $taskData = json_decode($data, true);
                     $taskData['stage3_recharge_target'] = $newRechargeTarget;
-                    $taskData['stage3_bet_target'] = $newBetTarget;
-                    $taskData['stage3_loop_count'] = $newLoopCount;
-                    $taskData['stage3_task1'] = false;
-                    $taskData['stage3_task2'] = false;
+                    $taskData['stage3_bet_target']      = $newBetTarget;
+                    $taskData['stage3_loop_count']      = $newLoopCount;
+                    // 记录当前总充值 / 总流水作为下一轮的基准值
+                    $taskData['stage3_recharge_base']   = $rechargeTotal;
+                    $taskData['stage3_bet_base']        = $totalBetAmount;
+                    // 重置本轮任务状态和进度
+                    $taskData['stage3_task1']           = false;
+                    $taskData['stage3_task2']           = false;
+                    $taskData['stage3_recharge_progress'] = 0;
+                    $taskData['stage3_bet_progress']      = 0;
                     
                     // 保存到数据库
                     $this->saveUserTaskData($userId, $taskData);
@@ -1203,17 +1219,32 @@ class ActivityController extends Controller
         if ($taskData['stage2_completed'] ?? false) {
             // 获取充值总额(从 RecordUserTotalStatistics)
             $rechargeTotal = $userTotalStatistics ? ($userTotalStatistics->Recharge) : 0;
-            $taskData['stage3_recharge_progress'] = $rechargeTotal;
-            
             // 获取下注流水(使用 total_bet)
-            $taskData['stage3_bet_progress'] = $taskData['total_bet'] ?? 0;
-            
-            // 初始化目标值(如果不存在)
-            if (!isset($taskData['stage3_recharge_target'])) {
-                $taskData['stage3_recharge_target'] = 200;
-            }
-            if (!isset($taskData['stage3_bet_target'])) {
-                $taskData['stage3_bet_target'] = 1000;
+            $totalBetAmount = $taskData['total_bet'] ?? 0;
+
+            $currentLoop = $taskData['stage3_loop_count'] ?? 0;
+
+            if ($currentLoop == 0) {
+                // 第一次:使用总充值 / 总流水,目标 200 / 1000
+                $taskData['stage3_recharge_progress'] = $rechargeTotal;
+                $taskData['stage3_bet_progress'] = $totalBetAmount;
+
+                if (!isset($taskData['stage3_recharge_target'])) {
+                    $taskData['stage3_recharge_target'] = 200;
+                }
+                if (!isset($taskData['stage3_bet_target'])) {
+                    $taskData['stage3_bet_target'] = 1000;
+                }
+            } else {
+                // 第二轮及之后:只统计本轮新增部分(再充值100、再下注500)
+                $baseRecharge = $taskData['stage3_recharge_base'] ?? $rechargeTotal;
+                $baseBet      = $taskData['stage3_bet_base'] ?? $totalBetAmount;
+
+                $taskData['stage3_recharge_progress'] = max(0, $rechargeTotal - $baseRecharge);
+                $taskData['stage3_bet_progress']      = max(0, $totalBetAmount - $baseBet);
+
+                $taskData['stage3_recharge_target'] = 100;
+                $taskData['stage3_bet_target']      = 500;
             }
         }