瀏覽代碼

fix superball tier reward

laowu 2 天之前
父節點
當前提交
b70017792e
共有 1 個文件被更改,包括 6 次插入24 次删除
  1. 6 24
      app/Services/SuperballActivityService.php

+ 6 - 24
app/Services/SuperballActivityService.php

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