| | |
| | | #导入
|
| | | 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
|
| | | #---------------------------------------------------------------------
|
| | | #全局变量
|
| | |
|
| | |
| | | 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
|
| | |
|
| | | if playerAccID == '':
|
| | | return GMCommon.Def_NoTag, ''
|
| | | playerID = curPlayer.GetPlayerID()
|
| | |
|
| | | return GMCommon.Def_DoQueryLogDB, playerAccID
|
| | | Result = GMCommon.Def_Unknow
|
| | |
|
| | | 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
|
| | |
|
| | |
|