Quellcode durchsuchen

排行榜接口正式上线

cyzhao vor 1 Jahr
Ursprung
Commit
514255bda7

+ 21 - 0
Gameserver/App/model/User/Info_Gates.php

@@ -26,6 +26,12 @@ class Info_Gates extends Object_ext {
      */
     public $UnlockedGatesMaxId = 0;
 
+    /**
+     * 最大通关id
+     * @var type
+     */
+    public $maxPassGateId = 0;
+
     /**
      * 章节列表
      * @var Ins_GateInfo
@@ -185,4 +191,19 @@ class Info_Gates extends Object_ext {
             }
         }
     }
+    
+    /**
+     * 最大通关id 
+     */
+    public function maxPassGateId($gateId) {
+        $maxIndex = 0;
+        $maxGateId = 0;
+        foreach ($this->GateList as $gateId => $Ins_GateInfo) {
+            if($Ins_GateInfo->pass > 0 && $Ins_GateInfo->GateMapTypeFromId($gateId) > $maxIndex){
+                $maxIndex = $Ins_GateInfo->GateMapTypeFromId($gateId);
+                $maxGateId = $gateId;
+            }
+        }
+        return $maxGateId;
+    }
 }

+ 1 - 1
Gameserver/App/model/User/Ins_GateInfo.php

@@ -82,7 +82,7 @@ class Ins_GateInfo {
     }
 
     /**
-     * 从gateId中提取地图序号(最大999)
+     * 关卡序号(最大999)
      * @param type $gateId
      * @return int
      */

+ 9 - 3
Gameserver/App/process/FightProc.php

@@ -544,6 +544,11 @@ class FightProc {
             if (ctx()->gates->GateList->$gateId->pass == 0) {
                 ctx()->gates->GateList->$gateId->pass = 1;
                 TaskProc::Day7TaskReset($gateId);                               # 刷新七日任务
+                $maxGateId= ctx()->gates->maxPassGateId();
+                if($maxGateId > 0){
+                    self::Ranking_MainGateIndex($maxGateId);
+                }
+                
             }
             TaskProc::OnPassGate_X($gateId);                                    # 刷新任务进度: 通关第X关
 
@@ -698,9 +703,10 @@ class FightProc {
      */
     public static function Ranking_MainGateIndex($maxGateIndex) {
         $memKey = MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid);
-        $mem = gMem();
-        $arr = array();
-        $uid = req()->uid;
+        $mem = gMem();    
+        
+        $uid = req()->uid;      
+        $arr = array();                   
         $arr["$uid"] = $maxGateIndex;
         $mem->zadd($memKey, $arr);