#!/usr/bin/python # -*- coding: GBK -*- #--------------------------------------------------------------------- # #--------------------------------------------------------------------- ##@package GMT_CTG # GMÃüÁîCTG # # @author whx # @date 2012-08-27 13:59 # @version 1.0 # # @note #--------------------------------------------------------------------- """Version = 2012-08-27 13:59""" #--------------------------------------------------------------------- #µ¼Èë 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 #--------------------------------------------------------------------- #È«¾Ö±äÁ¿ #--------------------------------------------------------------------- ## ÊÕµ½gmÃüÁîÖ´ÐÐ # @param gmCmdDict:gmÃüÁî×Öµä # @return None def OnExec(gmCmdDict): queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '') Result = GMCommon.Def_ParamErr errorMsg = "" if queryType not in [GMCommon.Def_GMKey_PlayerAccID, GMCommon.Def_GMKey_PlayerName]: return Result, errorMsg if len(playerFind) <= 0: return Result, errorMsg curPlayer = None if queryType == GMCommon.Def_GMKey_PlayerName: curPlayer = GameWorld.GetPlayerManager().FindPlayerByName(playerFind) else: curPlayer = GameWorld.GetPlayerManager().FindPlayerByAccID(playerFind) if not curPlayer or curPlayer.IsEmpty(): Result = GMCommon.Def_Success # ²»ÔÚÏß return Result, errorMsg playerID = curPlayer.GetPlayerID() 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