From efc705c4fb10577ff83e09273c90a6ead41164bd Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 30 五月 2025 12:08:45 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_ServerCode --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/Commands/GMT_CTG.py | 115 ++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 72 insertions(+), 43 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/Commands/GMT_CTG.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/Commands/GMT_CTG.py index e6fb080..feab2a7 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/Commands/GMT_CTG.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/Commands/GMT_CTG.py @@ -17,6 +17,15 @@ #导入 import GMCommon from MangoDBCommon import fix_incomingText +import GameWorld +from Player import (PlayerControl, PlayerCoin) +import IpyGameDataPY +import IPY_GameWorld +import ShareDefine +import DataRecordPack +import ChConfig +from PyMongoDB.GMToolLogicProcess import GMToolPyInterface +import json #--------------------------------------------------------------------- #全局变量 @@ -28,56 +37,76 @@ def OnExec(gmCmdDict): queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '') - #value = gmCmdDict.get('value', '') + Result = GMCommon.Def_ParamErr + errorMsg = "" if queryType not in [GMCommon.Def_GMKey_PlayerAccID, GMCommon.Def_GMKey_PlayerName]: - return GMCommon.Def_ParamErr, '' + return Result, errorMsg if len(playerFind) <= 0: - return GMCommon.Def_ParamErr, '' + return Result, errorMsg - return GMCommon.Def_DoQueryUserDB, '' - - -## 查询logdb返回 -# @param logdb:logdb -# @param data:传入的信息 -# @param gmCmdDict:gm命令字典 -# @return None -def LogDBResponse(logdb, data, gmCmdDict): - if data == "": - return GMCommon.Def_DoQueryUserDB, '' - # 修改为离线可用 - return GMCommon.Def_SendToGameServer, '' -# if GMCommon.GetPlayerOnLineByAccID(logdb, data): -# return GMCommon.Def_SendToGameServer, '' -# -# return GMCommon.Def_PlayerOfLine, '' - - -## 查询userdb返回 -# @param userdb:userdb -# @param data:传入的信息 -# @param gmCmdDict:gm命令字典 -# @return None -def UserDBResponse(userdb, data, gmCmdDict): - queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') - playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '') - - playerAccID = "" - # 玩家姓名 + curPlayer = None if queryType == GMCommon.Def_GMKey_PlayerName: - playerAccID = GMCommon.GetPlayerAccID(userdb, {'PlayerName':fix_incomingText(playerFind), 'IsDeleted':0}) + curPlayer = GameWorld.GetPlayerManager().FindPlayerByName(playerFind) + else: + curPlayer = GameWorld.GetPlayerManager().FindPlayerByAccID(playerFind) - elif queryType == GMCommon.Def_GMKey_PlayerAccID: - playerAccID = GMCommon.GetPlayerAccID(userdb, {'AccID':fix_incomingText(playerFind), 'IsDeleted':0}) + if not curPlayer or curPlayer.IsEmpty(): + Result = GMCommon.Def_Success + # 不在线 + return Result, errorMsg + + playerID = curPlayer.GetPlayerID() - if playerAccID == '': - return GMCommon.Def_NoTag, '' + Result = GMCommon.Def_Unknow - return GMCommon.Def_DoQueryLogDB, playerAccID + value = gmCmdDict.get('value', '') + appID = gmCmdDict.get('appID', '') + isAddBourseMoney = GameWorld.ToIntDef(gmCmdDict.get('isAddBourseMoney', ''), 0) + + goldBefore = PlayerControl.GetMoneyReal(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money) + changeCoinPointBefore = curPlayer.GetChangeCoinPointTotal() + bourseMoneyBefore = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney) + - - - - + orderInfoIpyData = None + if appID: + orderInfoIpyData = IpyGameDataPY.GetIpyGameDataNotLog("OrderInfo", value, appID) + if not orderInfoIpyData: + Result = GMCommon.Def_ParamErr + errorMsg = "Can not found the orderInfo(%s) and appID(%s)!" % (value, appID) + + if errorMsg: + return Result, errorMsg + + orderRMB = GameWorld.ToNumDef(value, None) + if not orderInfoIpyData and orderRMB != None: + if PlayerCoin.PlayerCoinToGoldEx(curPlayer, orderRMB, ChConfig.Def_GiveMoney_GMTCTG, isAddBourseMoney): + Result = GMCommon.Def_Success + else: + errorMsg = "order error! value(%s)" % (value) + else: + orderInfo = value + if PlayerCoin.DoGMCTG(curPlayer, orderInfo, appID, isAddBourseMoney, ChConfig.Def_GiveMoney_GMTCTG): + Result = GMCommon.Def_Success + else: + errorMsg = "orderInfo error! appID(%s), value(%s)" % (appID, value) + + if Result != GMCommon.Def_Success: + return Result, errorMsg + + goldAfter = PlayerControl.GetMoneyReal(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money) + changeCoinPointAfter = curPlayer.GetChangeCoinPointTotal() + bourseMoneyAfter = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney) + + resultDict = {"value":value, "appID":appID, "isAddBourseMoney":isAddBourseMoney, "Result":Result, + "gold":[goldBefore, goldAfter], "changeCoinPoint":[changeCoinPointBefore, changeCoinPointAfter], + "bourseMoney":[bourseMoneyBefore, bourseMoneyAfter]} + + #流向 增加金额记录 + DataRecordPack.DR_ToolGMOperate(playerID, curPlayer.GetPlayerName(), curPlayer.GetAccID(), 'GMT_CTG', resultDict) + + return Result, resultDict + + \ No newline at end of file -- Gitblit v1.8.0