From bc5f3f1c88d225109fa39a85b209ef13f5fb52a9 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 06 二月 2026 21:28:13 +0800
Subject: [PATCH] 66 【公会】基础主体-服务端(跨服公会所有基本功能支持、跨服砍价支持;修改查看目标公会、查看目标玩家方式;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ReadChConfig.py |   98 ++++++++++++++++--------------------------------
 1 files changed, 33 insertions(+), 65 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ReadChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ReadChConfig.py
index c122de1..83033e1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ReadChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ReadChConfig.py
@@ -41,13 +41,8 @@
 AllChConfig = {}
 GeneralProgramme = {}
 ServersRouteConfig = None
+ServersConfigDict = {}
 PyMongoDataServerConfig = None
-DBAllChConfig = {}
-
-# db路径下对应的配置文件路径 {key:path, ...}
-Def_DBCfgFilePath = {
-                     "DBPlatformNum":"\\Config\\DBPlatformNum.txt",
-                     }
 
 #---------------------------------------------------------------------
 ## 获取原样的Config此方法仅用于公式 !!!!
@@ -101,11 +96,27 @@
 
 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
 
 ## 重读,清除配置
@@ -114,17 +125,11 @@
 def ClearAllConfig():
     global AllChConfig
     global GeneralProgramme
-    global PyMongoDataServerConfig
-    global ServersRouteConfig
-    global DBAllChConfig
     
     #重读所有的配置表
     AllChConfig = {}
     GeneralProgramme = {}
     FormulaControl.ClearCompileFormulaDist()
-    PyMongoDataServerConfig = None
-    ServersRouteConfig = None
-    DBAllChConfig = {}
     
     GameWorld.Log('MapServer_Reload_ChConfig')
     #关闭字典
@@ -244,6 +249,22 @@
     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: 配置项名
@@ -272,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