From aaed213c21d0281458261cb4779e0b84582639f8 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 17 十一月 2023 16:48:27 +0800
Subject: [PATCH] 10011 【主干】【港台】【后台】邮件增加类型区分(个人、全服邮件发送及管理支持邮件类型)

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py
index d899b51..0a823ba 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py
@@ -412,7 +412,7 @@
 #  @return GUID
 #  @remarks addItemList支持append字典
 def SendPersonalItemMail(title, content, limitTime, playerIDList, addItemList, gold = 0, goldPaper = 0, silver = 0, 
-                         detail="", moneySource=ChConfig.Def_GiveMoney_Mail, crossMail=False):
+                         detail="", moneySource=ChConfig.Def_GiveMoney_Mail, crossMail=False, mailType=0):
     if not playerIDList:
         return ""
     
@@ -442,20 +442,24 @@
         startIndex = i*perMailItemCnt
         GUID = str(uuid.uuid1())
         AddPersonalItem(GUID, addItemDictList[startIndex:startIndex + perMailItemCnt], playerIDList, 
-                                           limitTime, "%s<$_$>%s<$_$>%s" % (ChConfig.Def_Mail_SenderSys, title, content),
+                                           limitTime, GetMailText(title, content, mailType),
                                            gold, goldPaper, silver, detail, moneySource, crossMail)
     return GUID
 
 ## 发送纯文字个人补偿
 #  @param limitTime 可以传空
 #  @return None
-def SendPersonalAsTextMail(PlayerID, title, content, limitTime):
+def SendPersonalAsTextMail(PlayerID, title, content, limitTime, mailType=0):
     if GameWorld.IsCrossServer():
         return
     GUID = str(uuid.uuid1())
     PyAddPersonalCompensation(GUID, PlayerID, GameWorld.GetCurrentDataTimeStr(), limitTime, 
-                              "%s<$_$>%s<$_$>%s" % (ChConfig.Def_Mail_SenderSys,title, content))
+                              GetMailText(title, content, mailType))
     return
+
+def GetMailText(title, content, mailType=0, sender=ChConfig.Def_Mail_SenderSys):
+    ## 获取邮件字段 Text 内容
+    return "%s<$_$>%s<$_$>%s<$_$>%s" % (sender, title, content, mailType)
 
 def GetEntireCompensationInfo(checkState, limitLVType, limitLV):
     return checkState * 1000000 + limitLVType * 100000 + limitLV
@@ -480,9 +484,10 @@
         compensation = compensationMgr.PersonalCompensationAt(playerID, i)
         
         contentList = compensation.Text.split("<$_$>")
-        if len(contentList) != 3:
+        if len(contentList) < 3:
             continue
-        sender, title, content = contentList
+        sender, title, content = contentList[:3]
+        mailType = GameWorld.ToIntDef(contentList[3]) if len(contentList) > 3 else 0
         
         if tempSign in content and tempSignEnd in content:
             title = content[content.index(tempSign) + len(tempSign):content.index(tempSignEnd)]
@@ -501,7 +506,7 @@
         recState = compensationMgr.FindPlayerRecState(playerID, GUID)
         
         infoDict = {"GUID":GUID, "Gold":compensation.Gold, "GoldPaper":compensation.GoldPaper, "Silver":compensation.Silver,
-                    "Sender":sender, "Title":title, "Content":content, "RecState":recState,
+                    "Sender":sender, "Title":title, "Content":content, "RecState":recState, "MailType":mailType,
                     "CreateTime":compensation.CreateTime, "LimitTime":compensation.LimitTime, "ItemList":itemList}
         
         retList.append(infoDict)
@@ -550,9 +555,10 @@
         return
     
     contentList = compensation.Text.split("<$_$>")
-    if len(contentList) != 3:
+    if len(contentList) < 3:
         return
-    sender, title, content = contentList
+    sender, title, content = contentList[:3]
+    mailType = GameWorld.ToIntDef(contentList[3]) if len(contentList) > 3 else 0
     
     if searchTitle and searchTitle not in title:
         return
@@ -574,7 +580,7 @@
             continue
         itemList.append([itemID, curItem.Count, curItem.IsBind, curItem.UserData])
         
-    compensationDict = {"GUID":GUID, "CheckState":checkState, "LimitLVType":limitLVType, "LimitLV":limitLV,
+    compensationDict = {"GUID":GUID, "CheckState":checkState, "LimitLVType":limitLVType, "LimitLV":limitLV, "MailType":mailType,
                         "Gold":compensation.Gold, "GoldPaper":compensation.GoldPaper, "Silver":compensation.Silver,
                         "PlayerJob":compensation.PlayerJob, "Sender":sender, "Title":title, "Content":content, "OnlyServerID":compensation.ServerID,
                         "CreateTime":compensation.CreateTime, "LimitTime":compensation.LimitTime, "ItemList":itemList}
@@ -639,7 +645,7 @@
     return successGUIDList
 
 def SendEntireMail(mailTypeKey, getDays, limitLV, limitLVType, addItemList=[], paramList=[], \
-                   gold=0, goldPaper=0, silver=0, detail="", moneySource=ChConfig.Def_GiveMoney_Mail, GUID=""):
+                   gold=0, goldPaper=0, silver=0, detail="", moneySource=ChConfig.Def_GiveMoney_Mail, GUID="", mailType=0):
     ''' 发送全服邮件
     @param mailTypeKey: 邮件模板key
     @param getDays: 有效天数
@@ -675,7 +681,7 @@
     PlayerJob = 127 # 默认全职业可领
     serverID = 0 # 默认所有服务器ID
     
-    AddEntireItem(GUID, addItemDictList, limitTime, mailInfo, PlayerJob, "%s<$_$>%s<$_$>%s" % (sender, title, content), 
+    AddEntireItem(GUID, addItemDictList, limitTime, mailInfo, PlayerJob, GetMailText(title, content, mailType, sender), 
                   gold, goldPaper, silver, detail, serverID)
     return
 

--
Gitblit v1.8.0