From d196d101b54ca95a1343399841d6b4e1117143b7 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 04 六月 2025 14:53:08 +0800
Subject: [PATCH] 16 卡牌服务端(GMT命令个人邮件、全服邮件相关;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMail.py |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMail.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMail.py
index c6118c8..184f1f3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMail.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMail.py
@@ -56,13 +56,15 @@
             #GameWorld.DebugLog("全服邮件未超时,不删除! %s,createTime=%s,limitTime=%s" % (guid, mailObj.GetCreateTime(), GameWorld.ChangeTimeNumToStr(limitTime)))
             continue
         
-        DelServerMail(guid)
+        DelServerMail(guid, "Timeout")
         
     return
 
-def DelServerMail(guid):
+def DelServerMail(guid, delEvent=""):
+    GameWorld.Log("删除全服邮件: %s" % (guid))
     mailMgr = DBDataMgr.GetMailMgr()
     playerStateDict = mailMgr.DelServerMail(guid)
+    DataRecordPack.DR_ServerMail(guid, "Delete" + delEvent)
     if not playerStateDict:
         return
     playerMgr = GameWorld.GetPlayerManager()
@@ -175,15 +177,23 @@
     @param limitLV: 限制可领的最低等级
     @param limitLVType: 等级达到后是否可领,默认不可
     @param checkState: 是否需要审核,默认不需要
+    @return: None - 发送失败; mailObj - 成功发送的邮件实例
     '''
     mailMgr = DBDataMgr.GetMailMgr()
     mailObj = mailMgr.AddServerMail(guid, title, text, itemList, limitDays, mailType)
+    if not mailObj:
+        return mailObj
+    GUID = mailObj.GetGUID()
     mailObj.SetLimitLV(limitLV)
     mailObj.SetLimitLVType(limitLVType)
     mailObj.SetCheckState(checkState)
+    eventName = "Add" if not checkState else "AddToCheck"
+    addDict = {"LimitDays":limitDays, "LimitLV":limitLV, "LimitLVType":limitLVType, "CheckState":checkState, 
+               "title":title, "Text":text, "ItemList":itemList}
+    DataRecordPack.DR_ServerMail(GUID, eventName, addDict)
     if not checkState:
         Sync_ServerMail(mailObj.GetGUID())
-    return
+    return mailObj
 
 def CheckServerMailResult(guid, isOK):
     ## 审核全服邮件结果
@@ -193,8 +203,12 @@
     if not mailObj:
         return
     if not isOK:
+        # 审核不通过的直接删除
+        DelServerMail(guid, "GMDel")
         return
+    GameWorld.Log("全服邮件审核通过: %s" % guid)
     mailObj.SetCheckState(0) # 设置为0,不需要审核了,即通过
+    DataRecordPack.DR_ServerMail(guid, "CheckOK")
     Sync_ServerMail(guid)
     return
 
@@ -325,11 +339,12 @@
     Sync_PlayerMailState(curPlayer, notifyGUIDState)
     return
 
-def doMailDel(curPlayer, guid, isGM=False):
+def doMailDel(curPlayer, guid, isGM=False, playerID=0):
     ## 执行邮件删除
     # @param isGM: 是否GM删除,无视物品是否已领取,强制删除
     
-    playerID = curPlayer.GetPlayerID()
+    if curPlayer:
+        playerID = curPlayer.GetPlayerID()
     mailMgr = DBDataMgr.GetMailMgr()
     
     # 批量处理,仅针对个人邮件
@@ -357,7 +372,8 @@
             DataRecordPack.DR_MailDel(playerID, guid, "GMDel")
         # 这里玩家主动删除的可不记录流向,因为未读未领取不允许主动删除,已领取的已有领取记录,所以可不记录
         
-    Sync_PlayerMailState(curPlayer, notifyGUIDState)
+    if curPlayer:
+        Sync_PlayerMailState(curPlayer, notifyGUIDState)
     return
 
 def Sync_ServerMail(guid):

--
Gitblit v1.8.0