From db168633a2853111b43c413779a5535228dfe61c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 09 二月 2026 20:20:24 +0800
Subject: [PATCH] 462 【付费活动】限时冲刺-服务端(轮回殿支持消费货币冲制;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ReadChConfig.py |  133 ++++++++++++++++++++++----------------------
 1 files changed, 67 insertions(+), 66 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ReadChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ReadChConfig.py
index 08d278d..83033e1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ReadChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ReadChConfig.py
@@ -27,10 +27,10 @@
 import os
 import GameWorld
 import md5
+import IpyGameDataPY
 import FormulaControl
 import ConfigParser
 import ShareDefine
-import MapConfig
 #---------------------------------------------------------------------
 #全局变量
 #---------------------------------------------------------------------
@@ -40,13 +40,9 @@
 
 AllChConfig = {}
 GeneralProgramme = {}
+ServersRouteConfig = None
+ServersConfigDict = {}
 PyMongoDataServerConfig = None
-DBAllChConfig = {}
-
-# db路径下对应的配置文件路径 {key:path, ...}
-Def_DBCfgFilePath = {
-                     "DBPlatformNum":"\\Config\\DBPlatformNum.txt",
-                     }
 
 #---------------------------------------------------------------------
 ## 获取原样的Config此方法仅用于公式 !!!!
@@ -98,6 +94,30 @@
     
     return
 
+def SetReloadConfig():
+    ## 标记重读配置
+    global PyMongoDataServerConfig
+    global ServersRouteConfig
+    global ServersConfigDict
+    
+    GameWorld.Log("=== 设置重读配置 ===")
+    GameWorld.GetGameWorld().SetGameWorldDict(ShareDefine.Def_Notify_WorldKey_ReloadConfig, 1)
+    PyMongoDataServerConfig = None
+    ServersRouteConfig = None
+    ServersConfigDict = {}
+    IpyGameDataPY.IPYData.IpyDataClear()
+    import DataRecordPack
+    DataRecordPack.DR_Reload("config")
+    OnReloadConfig()
+    return
+
+def OnReloadConfig():
+    ## 配置文件重读后需要额外处理的逻辑
+    GameWorld.Log("OnReloadConfig...")
+    if GameWorld.IsCrossCenter():
+        import DBFamily
+        DBFamily.OnReloadConfig()
+    return
 
 ## 重读,清除配置
 #  @param key 表名
@@ -105,17 +125,11 @@
 def ClearAllConfig():
     global AllChConfig
     global GeneralProgramme
-    global PyMongoDataServerConfig
-    global DBAllChConfig
     
     #重读所有的配置表
     AllChConfig = {}
     GeneralProgramme = {}
     FormulaControl.ClearCompileFormulaDist()
-    PyMongoDataServerConfig = None
-    DBAllChConfig = {}
-    
-    MapConfig.ClearConfig()
     
     GameWorld.Log('MapServer_Reload_ChConfig')
     #关闭字典
@@ -211,6 +225,46 @@
 
 ## -----------------------------------------------------------
 
+def GetServersRouteConfig(section, option, raw=False, defaultValue=None, isLog=True):
+    global ServersRouteConfig
+    
+    if not ServersRouteConfig:
+        filePath = ChConfig.GetServersRoutePath() + "\\PyMongoDataServer.ini"
+        
+        if not os.path.isfile(filePath):
+            GameWorld.Log('无法找到文件 = %s'%(filePath))
+            raise Exception('无法找到文件 = %s'%(filePath))
+        
+        ServersRouteConfig = ConfigParser.ConfigParser()
+        ServersRouteConfig.read(filePath)
+        GameWorld.DebugLog("Reload %s" % str(filePath))
+        
+    if not ServersRouteConfig.has_option(section, option):
+        if defaultValue != None:
+            return defaultValue
+        if isLog:
+            GameWorld.ErrLog("ServersRoute->PyMongoDataServer.ini找不到配置: section=%s,option=%s" % (section, option))
+        return ""
+    
+    strParam = ServersRouteConfig.get(section, option, raw)
+    return strParam
+
+def GetServerConfigDict():
+    global ServersConfigDict
+    if not ServersConfigDict:
+        filePath = ChConfig.GetServersRoutePath() + "\\Config\\ServersConfig.json"
+        if not os.path.isfile(filePath):
+            GameWorld.Log('无法找到文件 = %s'%(filePath))
+            raise Exception('无法找到文件 = %s'%(filePath))
+        
+        f = open(filePath, 'r')
+        strMsg = f.read()
+        f.close()
+        
+        ServersConfigDict = eval(strMsg)
+        
+    return ServersConfigDict
+
 ## PyMongoDataServer.ini配置读取
 #  @param section: 分段区块名
 #  @param option: 配置项名
@@ -239,56 +293,3 @@
     
     strParam = PyMongoDataServerConfig.get(section, option, raw)
     return strParam
-
-def GetDBConfig(key): return __DoLogic_GetDBConfig(key)
-def GetDBEvalChConfig(key): return __DoLogic_GetDBConfig(key, True)
-
-## 通过key查找策划表,如果还未加载,则进行加载
-#  @param key 表名
-#  @return None
-#  @remarks 函数详细说明.
-def __DoLogic_GetDBConfig(key, needEval=False):
-    global DBAllChConfig
-    
-    #是否重读所有的配置表
-    if GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ReloadConfig):
-        ClearAllConfig()
-    else:
-        #找到了,就返回
-        if DBAllChConfig.has_key(key):
-            return DBAllChConfig[key]
-        
-    if key not in Def_DBCfgFilePath:
-        GameWorld.Log('DB配置中未发现Key文件 = %s' % (key))
-        return
-    filePath = ChConfig.GetServerConfigPath() + Def_DBCfgFilePath[key]
-    
-    retData = __ReadConfigDataEx(key, filePath, needEval)
-    if not retData:
-        return
-    DBAllChConfig.update({key:retData})
-    return retData
-
-def __ReadConfigDataEx(fileName, filePath, needEval):
-    
-    if not os.path.isfile(filePath):
-        GameWorld.Log('未发现目标文件 = %s' % (filePath))
-        raise Exception ('未发现目标文件 = %s' % (filePath))
-    
-    file = open(filePath, 'r')
-    strMsg = file.read()
-    file.close()
-    
-    if needEval:
-        try:
-            result = eval(strMsg)
-        except BaseException, e:
-            GameWorld.Log('获取配置信息Key = %s 读取失败,无法解析原因:%s, 抛出,%s' % (fileName, e, strMsg))
-            raise Exception('获取配置信息Key = %s 读取失败' % fileName)
-        
-        return result
-    
-    else:
-        #编译后储存
-        return compile(strMsg, 'ReadChConfig', 'eval')
-

--
Gitblit v1.8.0