hxp
2025-06-04 71d77df560af421d106484e9276e89297b88e40a
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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_AddPersonalCompensation
#
# @todo:GM¹¤¾ßÃüÁî - Ìí¼Ó¸öÈËÓʼþ
# @author hxp
# @date 2025-06-04
# @version 1.0
#
# ÏêϸÃèÊö: GM¹¤¾ßÃüÁî - Ìí¼Ó¸öÈËÓʼþ
#
#-------------------------------------------------------------------------------
#"""Version = 2025-06-04 15:00"""
#-------------------------------------------------------------------------------
 
import GameWorld
import GMCommon
import DataRecordPack
import PlayerMail
 
## ÊÕµ½gmÃüÁîÖ´ÐÐ
# @param gmCmdDict:gmÃüÁî×Öµä
# @return None 
def OnExec(gmCmdDict):
    from GMToolLogicProcess import  ProjSpecialProcess
    ret = ProjSpecialProcess.GMCmdPlayerListValidationID(gmCmdDict)
    Result = ret[0]
    if Result != GMCommon.Def_Success:
        return Result, ret[1]
    playerIDList = ret[1]
    
    LimitDays = int(gmCmdDict.get('LimitDays', '7'))
    MailType = int(gmCmdDict.get('MailType', '0'))
    Title = gmCmdDict.get('Title', '')
    Text = gmCmdDict.get('Text', '')
    itemList = GetGMTMailItemList(gmCmdDict)
    
    for playerID in playerIDList:
        PlayerMail.SendMail(playerID, Title, Text, itemList, LimitDays, MailType)
        
    # Á÷Ïò
    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