#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
##@package Player.RemoteQuery.GY_Query_GMTDelPlayerMoney  
 | 
#  
 | 
# @todo:GM¹¤¾ß¿Û³ýÍæ¼Ò»õ±Ò  
 | 
# @author hxp  
 | 
# @date 2021-03-18  
 | 
# @version 1.0  
 | 
#  
 | 
# ÏêϸÃèÊö: GM¹¤¾ß¿Û³ýÍæ¼Ò»õ±Ò  
 | 
#  
 | 
#-------------------------------------------------------------------------------  
 | 
#"""Version = 2021-03-18 19:00"""  
 | 
#-------------------------------------------------------------------------------  
 | 
  
 | 
import GMCommon  
 | 
import ShareDefine  
 | 
import PlayerControl  
 | 
import GameWorld  
 | 
import ChConfig  
 | 
  
 | 
## ÇëÇóÂß¼  
 | 
#  @param query_Type ÇëÇóÀàÐÍ  
 | 
#  @param query_ID ÇëÇóµÄÍæ¼ÒID  
 | 
#  @param packCMDList ·¢°üÃüÁî [ ]  
 | 
#  @param tick µ±Ç°Ê±¼ä  
 | 
#  @return resultDisc  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def DoLogic(query_Type, query_ID, packCMDList, tick):  
 | 
    curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(query_ID)  
 | 
      
 | 
    if not curPlayer or curPlayer.IsEmpty():  
 | 
        return ''  
 | 
      
 | 
    orderId, gmCmdDict  = packCMDList  
 | 
    moneyType = GameWorld.ToIntDef(gmCmdDict.get("moneyType"))  
 | 
    moneyValue = GameWorld.ToIntDef(gmCmdDict.get("moneyValue"))  
 | 
    delRemark = gmCmdDict.get("delRemark", "")  
 | 
      
 | 
    retMsg = ""  
 | 
    Result = GMCommon.Def_Success  
 | 
    if moneyType not in [1, 2, 3, 4] and moneyType not in ShareDefine.TYPE_Price_CurrencyDict:  
 | 
        Result = GMCommon.Def_MoneyTypeErr  
 | 
    elif not moneyValue:  
 | 
        Result = GMCommon.Def_ParamErr  
 | 
        retMsg = "money value error."  
 | 
    #ÏÉÓñ¡¢°óÓñºǫֱ́½Ó¿Û³ýµÄ²»¼ì²é»õ±ÒÊÇ·ñ×ã¹»£¬Ö§³ÖÖ±½Ó¿Û³É¸ºÖµ  
 | 
    elif moneyType not in ShareDefine.MoneyMinusRefreshDict and not PlayerControl.HaveMoney(curPlayer, moneyType, moneyValue, False):  
 | 
        Result = GMCommon.Def_ParamErr  
 | 
        retMsg = "money is not enough. only %s" % PlayerControl.GetMoney(curPlayer, moneyType)  
 | 
          
 | 
    if Result == GMCommon.Def_Success:  
 | 
        infoDict = {ChConfig.Def_Cost_Reason_SonKey:delRemark}  
 | 
        if not PlayerControl.PayMoney(curPlayer, moneyType, moneyValue, ChConfig.Def_Cost_GM, infoDict, isNotify=False, isMinus=True):  
 | 
            Result = GMCommon.Def_Unknow  
 | 
            retMsg = "pay money error."  
 | 
        else:  
 | 
            retMsg = "remaining money %s" % PlayerControl.GetMoneyReal(curPlayer, moneyType)  
 | 
              
 | 
    resultMsg = str([orderId, retMsg, 'GMT_DelPlayerMoney', Result])  
 | 
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', resultMsg, len(resultMsg))  
 | 
    return ''  
 | 
      
 | 
      
 | 
      
 | 
      
 | 
     
 |