-------------------------------- -- 文件名 : MiddleCommonLogic -- 文件说明 : 跨服相关-通用管理(用于处理比较杂项的数据) -- 创建时间 : 2025/02/26 -- 创建人 : FC -------------------------------- local Config = require("Config") local Log = require("common.Log") local CommonDB = require("common.CommonDB") local InnerMsg = require("core.InnerMsg") local RoleLogic = require("role.RoleLogic") local Msg = require("core.Msg") local ObjHuman = require("core.ObjHuman") local function MiddleCommonLogic_WRITELOG(szText) Log.write(Log.LOGID_OSS_COMMON, "跨服通用管理"..szText) end -- 跨服获取玩家信息(源->中心服) function MiddleCommonLogic_GetChatPlayInfo_LW(human, msg) local tMsgData = InnerMsg.lw.LW_CHAT_PLAYER_INFO tMsgData.nSrcUID = human.db._id tMsgData.nDesUID = msg.uuid tMsgData.nSrcServerID = Config.SVR_INDEX tMsgData.nDesServerID = msg.nServerIndex print("[MiddleCommonLogic_GetChatPlayInfo_LW] ", tMsgData.nSrcUID, tMsgData.nDesUID, tMsgData.nSrcServerID, tMsgData.nDesServerID) InnerMsg.sendMsg(0, tMsgData) end -- 跨服获取玩家信息(中心服->目标) function MiddleCommonLogic_GetChatPlayInfo_WL(fd, msg) local msgRet = Msg.gc.GC_CHAT_PLAYER_INFO if not RoleLogic.makePlayInfo(msgRet.data, msg.nDesUID) then MiddleCommonLogic_WRITELOG("跨服获取玩家数据失败 nDesUID = "..msg.nDesUID.." nSrcUID = "..msg.nSrcUID.." nSrcServerID = "..msg.nSrcServerID) return end -- 获取数据发回中心服 local tMsgData = InnerMsg.lw.LW_CHAT_PLAYER_INFO_SEND tMsgData.nSrcUID = msg.nSrcUID tMsgData.nSrcServerID = msg.nSrcServerID tMsgData.tData = msgRet InnerMsg.sendMsg(0, tMsgData) print("[MiddleCommonLogic_GetChatPlayInfo_WL] 跨服获取玩家信息(中心服->目标)") end -- 获取到数据发送给请求的玩家 function MiddleCommonLogic_SendChatPlayInfo_WL(fd, msg) local nSrcUID = msg.nSrcUID local human = ObjHuman.onlineUuid[nSrcUID] if not human then print("[MiddleCommonLogic_SendChatPlayInfo_WL] 玩家不在线直接返回") return end local msgRet = Msg.gc.GC_CHAT_PLAYER_INFO msgRet.data = msg.tData.data Msg.send(msgRet, human.fd) print("[MiddleCommonLogic_SendChatPlayInfo_WL] 获取到数据发送给请求的玩家") end