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

Revert "fix superball tier reward"

This reverts commit b70017792e9e5ced4dc7d740e1e006ac3796805c.
laowu 1 день назад
Родитель
Сommit
4a8246de47
1 измененных файлов с 24 добавлено и 6 удалено
  1. 24 6
      app/Services/SuperballActivityService.php

+ 24 - 6
app/Services/SuperballActivityService.php

@@ -330,9 +330,15 @@ class SuperballActivityService
             $complete = 0;
         }
         // 所有任务累加
+        $tierConfigs = $this->getTierConfig();
         $ballCount = 0;
-        if ($complete) {
-            $ballCount = $tierConfig->ball_count;
+        foreach ($tierConfigs as $config) {
+            if ($config['sort_index'] < $tierConfig->sort_index) {
+                continue;
+            }
+            if ($config['recharge_required'] <= $rechargeToday && $config['turnover_required'] <= ($turnoverToday / NumConfig::NUM_VALUE)) {
+                $ballCount += (int) $config['ball_count'];
+            }
         }
 
         if ($ballCount < 1) {
@@ -399,8 +405,18 @@ class SuperballActivityService
 
         $ballCount = 0;
         $tierConfig = $this->getTierConfigByTier($task->tier);
+        $rechargeToday = $this->getUserRechargeForDate($userId, $today);
+        $turnoverToday = $this->getUserTotalBetForDate($userId, $today);
         if ($task && $task->status == 1) {
-            $ballCount = $tierConfig->ball_count;
+            $tierConfigs = $this->getTierConfig();
+            foreach ($tierConfigs as $config) {
+                if ($config['sort_index'] < $tierConfig->sort_index) {
+                    continue;
+                }
+                if ($config['recharge_required'] <= $rechargeToday && $config['turnover_required'] <= ($turnoverToday / NumConfig::NUM_VALUE)) {
+                    $ballCount += (int) $config['ball_count'];
+                }
+            }
         }
 
         $existing = DB::connection('write')->table(TableName::agent() . 'superball_user_balls')
@@ -635,9 +651,11 @@ class SuperballActivityService
         if (!$task || $task->status == 0) {
             $recharge = $this->getUserRechargeForDate($userId, $date);
             $turnover = $this->getUserTotalBetForDate($userId, $date) / NumConfig::NUM_VALUE;
-            $config = $this->getTierConfigByTier($task->tier);
-            if ($recharge >= $config['recharge_required'] && $turnover >= $config['turnover_required']) {
-                $ball = $config->ball_count;
+            $configs = $this->getTierConfig();
+            foreach ($configs as $config) {
+                if ($recharge >= $config['recharge_required'] && $turnover >= $config['turnover_required']) {
+                    $ball += $config['ball_count'];
+                }
             }
         }
         Redis::set($cacheKey, $ball);