فهرست منبع

fix superball tier reward1

laowu 2 روز پیش
والد
کامیت
9703acbfaa
1فایلهای تغییر یافته به همراه29 افزوده شده و 23 حذف شده
  1. 29 23
      app/Services/SuperballActivityService.php

+ 29 - 23
app/Services/SuperballActivityService.php

@@ -330,14 +330,16 @@ 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;
+        } else if ($tierConfig->tier !== 'E') { // 没完成获取上一级奖励
+            $idx = $tierConfig->sort_index-1;
+            $configs = $this->getTierConfig();
+            foreach ($configs as $config) {
+                if ($config['sort_index'] == $idx) {
+                    $ballCount += $config['ball_count'];
+                }
             }
         }
 
@@ -405,16 +407,16 @@ 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'];
+            if ($task->complete == 1) {
+                $ballCount = $tierConfig->ball_count;
+            } else if ($tierConfig->tier !== 'E') { // 没完成获取上一级奖励
+                $idx = $tierConfig->sort_index-1;
+                $configs = $this->getTierConfig();
+                foreach ($configs as $config) {
+                    if ($config['sort_index'] == $idx) {
+                        $ballCount += $config['ball_count'];
+                    }
                 }
             }
         }
@@ -648,13 +650,17 @@ class SuperballActivityService
         }
         $ball = 0;
         $task = $this->getUserTask($userId, $date);
-        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'];
+        if ($task && $task->status == 0) {
+            $config = $this->getTierConfigByTier($task->tier);
+            if ($task->complete) {
+                $ball = $config->ball_count;
+            } else if ($task->tier != 'E') {
+                $idx = $config->sort_index-1;
+                $configs = $this->getTierConfig();
+                foreach ($configs as $config) {
+                    if ($config['sort_index'] == $idx) {
+                        $ball += $config['ball_count'];
+                    }
                 }
             }
         }