From 87940848162256b5adaa125408b297dba3e8691b Mon Sep 17 00:00:00 2001
From: zhaojs <349234519@qq.com>
Date: 星期三, 12 七月 2023 10:48:02 +0800
Subject: [PATCH] no message

---
 application/api/logic/ActivityInfo.php |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/application/api/logic/ActivityInfo.php b/application/api/logic/ActivityInfo.php
index 04f1d9e..7800d0d 100644
--- a/application/api/logic/ActivityInfo.php
+++ b/application/api/logic/ActivityInfo.php
@@ -156,7 +156,7 @@
                 continue;
             }
             //娲诲姩瑙勫垯
-            $rewardRule=json_encode($act['act_json']);
+            $rewardRule=json_decode($act['act_json']);
             foreach($cusList as $cus)
             {//寰幆鍙備笌娲诲姩鐨勪細鍛�
                 $yqCount=Db::query('select count(1) as count from t_user where invitation_id=? and invite_bind_time>=? and invite_bind_time<=?',[$cus['user_id'],$cus['create_time'],$actEndTime]);
@@ -166,16 +166,18 @@
                 }
                 //璁$畻搴斿緱閲戦
                 $price=0;
-                switch($rewardRule['act_type'])
+                switch($rewardRule->act_type)
                 {
                     case 'step_all'://闃舵瀹屾垚鍚庤禒閫�
-                        $this->stepAllRule($rewardRule['rule'],$yqCount['count']);
+                        $price=$this->stepAllRule($rewardRule->rule,$yqCount[0]['count']);
                         break;
                     default:
-                        continue;
-                    break;
+                        break;
                 }
-
+                if($price<=0)
+                {
+                    continue;
+                }
 
                 $tradeId=$act['id'].$cus['user_id'];
                 //鎻掑叆鑱氭帹瀹㈢殑璁㈠崟
@@ -212,7 +214,19 @@
      */
     public function stepAllRule($rule,$yqCount)
     {
-        $currentStep=$rule->where('c_count','<=',$yqCount)->max('c_count');
+        $maxReward=0;
+        foreach($rule as $r_item)
+        {
+            if($r_item->c_count>$yqCount)
+            {
+                continue;
+            }
+            if($maxReward<$r_item->reward)
+            {
+                $maxReward=$r_item->reward;
+            }
+        }
+        return $maxReward;
     }
 
 }
\ No newline at end of file

--
Gitblit v1.9.3