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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_CompensationQueryPersonal
#
# @todo:GM¹¤¾ßÃüÁî - ¸öÈËÓʼþ²éѯ¹ÜÀí
# @author hxp
# @date 2025-06-04
# @version 1.0
#
# ÏêϸÃèÊö: GM¹¤¾ßÃüÁî - ¸öÈËÓʼþ²éѯ¹ÜÀí
#
#-------------------------------------------------------------------------------
#"""Version = 2025-06-04 15:00"""
#-------------------------------------------------------------------------------
 
import GMCommon
import GameWorld
import DataRecordPack
import PlayerMail
import DBDataMgr
 
## ÊÕµ½gmÃüÁîÖ´ÐÐ
# @param gmCmdDict:gmÃüÁî×Öµä
# @return None 
def OnExec(gmCmdDict):
    
    errorMsg = ""
    from GMToolLogicProcess import  ProjSpecialProcess
    Result, playerID = ProjSpecialProcess.GMCmdPlayerValidationID(gmCmdDict)
    if Result != GMCommon.Def_Success:
        return Result, errorMsg
    
    Result = GMCommon.Def_Unknow
    
    opType = gmCmdDict.get('opType', 'query')
    
    # Ôݽö×öɾ³ý¼°²éѯ
    if opType == "del":
        GUIDInfo = gmCmdDict.get('GUIDInfo', '')
        if not GUIDInfo:
            return GMCommon.Def_ParamErr
        
        delGUIDList = GUIDInfo.split(",")
        if not delGUIDList:
            return GMCommon.Def_ParamErr
        
        curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
        for delGUID in delGUIDList:
            PlayerMail.doMailDel(curPlayer, delGUID, True, playerID)
            
    else:
        pass
    
    mailList = __queryMailInfoList(playerID)
    
    #Á÷Ïò
    if opType == "del":
        GMT_Name = gmCmdDict.get(GMCommon.Def_GMKey_Type, '') 
        DataRecordPack.DR_ToolGMOperate(0, '', '', GMT_Name, str(gmCmdDict))
    return GMCommon.Def_Success, {"mailList":mailList}
    
def __queryMailInfoList(playerID):
    '''¸öÈ˲¹³¥Óʼþ²éѯ
    '''
    
    mailList = []
    mailMgr = DBDataMgr.GetMailMgr()
    guids = mailMgr.GetPersonalMailGuids(playerID)
    for guid in guids:
        mailObj = mailMgr.GetPersonalMail(playerID, guid)
        if not mailObj:
            continue
        title = mailObj.GetTitle()
        content = mailObj.GetText()
        mailType = mailObj.GetType()
        createTime = mailObj.GetCreateTime()
        limitDays = mailObj.GetLimitDays()
        mailState = mailObj.GetMailState()
        
        if "<T>" in title:
            title = title[3:-4]
            
        itemList = mailMgr.GetMailItemList(guid)
        infoDict = {"GUID":guid, "Title":title, "Content":content, "State":mailState, "MailType":mailType,
                    "CreateTime":createTime, "LimitDays":limitDays, "ItemList":itemList}
        mailList.append(infoDict)
        
    mailList.sort(key=lambda m:(m["CreateTime"]), reverse=True)
    return mailList