hxp
2026-03-06 e4a73fcd808bcf5e22099b73f2bc98e8b6ee84c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_DelPlayerMoney
#
# @todo:GM¹¤¾ßÃüÁî - ¿Û³ýÍæ¼Ò»õ±Ò
# @author hxp
# @date 2026-02-10
# @version 1.0
#
# ÏêϸÃèÊö: GM¹¤¾ßÃüÁî - ¿Û³ýÍæ¼Ò»õ±Ò
#
#-------------------------------------------------------------------------------
#"""Version = 2026-02-10 20:00"""
#-------------------------------------------------------------------------------
 
import GMCommon
import GameWorld
import DataRecordPack
import PlayerControl
import ShareDefine
import ChConfig
 
## ÊÕµ½gmÃüÁîÖ´ÐÐ
# @param gmCmdDict:gmÃüÁî×Öµä
# @return None 
def OnExec(gmCmdDict):
    
    errorMsg = ""
    from GMToolLogicProcess import  ProjSpecialProcess
    Result, curPlayer = ProjSpecialProcess.GMCmdPlayerValidation(gmCmdDict, False)
    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, '') 
    
    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, ShareDefine.TYPE_Price_PayCoin] 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)
            
    resultDict = {"retMsg":retMsg}
    Result = GMCommon.Def_Success
    #Á÷Ïò Ôö¼Ó½ð¶î¼Ç¼
    DataRecordPack.DR_ToolGMOperate(playerID, curPlayer.GetPlayerName(), curPlayer.GetAccID(), GMT_Name, resultDict)
    return Result, resultDict