hxp
2025-06-04 d196d101b54ca95a1343399841d6b4e1117143b7
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/Commands/GMT_AddPersonalCompensation.py
@@ -2,45 +2,69 @@
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_AddPersonalCompensation
#
##@package PyMongoDataServer.GMToolLogicProcess.Commands.GMT_AddPersonalCompensation
#
# @todo:个人补偿 - 新
# @todo:GM工具命令 - 添加个人邮件
# @author hxp
# @date 2014-09-23
# @date 2025-06-04
# @version 1.0
#
# 详细描述: 个人补偿 - 新
# 详细描述: GM工具命令 - 添加个人邮件
#
#---------------------------------------------------------------------
"""Version = 2014-09-23 12:00"""
#-------------------------------------------------------------------------------
#"""Version = 2025-06-04 15:00"""
#-------------------------------------------------------------------------------
import GameWorld
import GMCommon
#---------------------------------------------------------------------
#全局变量
#---------------------------------------------------------------------
import DataRecordPack
import PlayerMail
## 收到gm命令执行
# @param gmCmdDict:gm命令字典
# @return None 
def OnExec(gmCmdDict):
    playerList = gmCmdDict.get("playerList", "")  #玩家列表
    from GMToolLogicProcess import  ProjSpecialProcess
    ret = ProjSpecialProcess.GMCmdPlayerListValidationID(gmCmdDict)
    Result = ret[0]
    if Result != GMCommon.Def_Success:
        return Result, ret[1]
    playerIDList = ret[1]
    
    if playerList == "":
        return GMCommon.Def_ParamErr, "Please enter search player info!"
    LimitDays = int(gmCmdDict.get('LimitDays', '7'))
    MailType = int(gmCmdDict.get('MailType', '0'))
    Title = gmCmdDict.get('Title', '')
    Text = gmCmdDict.get('Text', '')
    itemList = GetGMTMailItemList(gmCmdDict)
    # 回复gm参数错误
    return GMCommon.Def_DoQueryUserDB, ''
    for playerID in playerIDList:
        PlayerMail.SendMail(playerID, Title, Text, itemList, LimitDays, MailType)
## 查询userdb返回
# @param userdb:userdb
# @param data:传入的信息
# @param gmCmdDict:gm命令字典
# @return None
def UserDBResponse(userdb, data, gmCmdDict):
    return GMCommon.Def_SendToGameServer, ''
    # 流向
    GMT_Name = gmCmdDict.get(GMCommon.Def_GMKey_Type, '')
    DataRecordPack.DR_ToolGMOperate(0, '', '', GMT_Name, str(gmCmdDict))
    return GMCommon.Def_Success
def GetGMTMailItemList(gmCmdDict):
    #工具发过来的物品下标依据 'index,index,...'  不一定是从0开始并按顺序连续 =_=#
    intemIndexStrList = []
    itemNums = gmCmdDict.get('itemNums', '')
    if itemNums.strip() != '':
        intemIndexStrList = itemNums.split(',')
    #添加物品
    itemList = []
    for itemIndexStr in intemIndexStrList:
        itemID = GameWorld.ToIntDef(gmCmdDict.get('ItemID%s' % itemIndexStr, '0'))
        if not itemID:
            continue
        itemCount = GameWorld.ToIntDef(gmCmdDict.get('ItemCnt%s' % itemIndexStr, '0'))
        if not itemCount:
            continue
        isBind = GameWorld.ToIntDef(gmCmdDict.get('IsBind%s' % itemIndexStr, '0'))
        #添加到物品信息列表
        itemList.append([itemID, itemCount, isBind])
    GameWorld.DebugLog("GetGMTMailItemList %s" % itemList)
    return itemList