#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_CTG
|
#
|
# @todo:GM¹¤¾ßÃüÁî - CTG³äÖµ
|
# @author hxp
|
# @date 2025-06-03
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: GM¹¤¾ßÃüÁî - CTG³äÖµ
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2025-06-03 14:00"""
|
#-------------------------------------------------------------------------------
|
|
import GMCommon
|
import GameWorld
|
from Player import (PlayerControl, PlayerCoin)
|
import IpyGameDataPY
|
import IPY_GameWorld
|
import DataRecordPack
|
import ShareDefine
|
import ChConfig
|
|
## ÊÕµ½gmÃüÁîÖ´ÐÐ
|
# @param gmCmdDict:gmÃüÁî×Öµä
|
# @return None
|
def OnExec(gmCmdDict):
|
|
errorMsg = ""
|
from GMToolLogicProcess import ProjSpecialProcess
|
Result, curPlayer = ProjSpecialProcess.GMCmdPlayerValidation(gmCmdDict)
|
if Result != GMCommon.Def_Success:
|
return Result, errorMsg
|
if not curPlayer:
|
return Result, "Íæ¼Ò²»ÔÚÏߣ¬ÉÏÏߺó´¦Àí"
|
|
# Íæ¼ÒÔÚÏߣ¬¿É´¦Àí
|
playerID = curPlayer.GetPlayerID()
|
Result = GMCommon.Def_Unknow
|
GMT_Name = gmCmdDict.get(GMCommon.Def_GMKey_Type, '')
|
|
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_Name, resultDict)
|
|
return Result, resultDict
|
|