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

---
 ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddPersonalCompensation.py            |    4 +++-
 ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py              |    5 +++--
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py                          |   30 ++++++++++++++++++------------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py |    3 ++-
 4 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py
index 6ba9f71..64a1421 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py
@@ -50,7 +50,7 @@
 #  @remarks 函数详细说明.
 def OnExec(orderId, gmCmdDict):
     gmCmdDict = ClearEmptyFromDict(gmCmdDict)
-    
+    GameWorld.DebugLog("GMT_AddEntireCompensation gmCmdDict:%s" % gmCmdDict)
     LimitTime = gmCmdDict.get('EndTime', '2050-12-13 00:00:00')
     curServerTime = GameWorld.GetCurrentDataTimeStr()
     # 当前时间已经超过领取时间
@@ -58,6 +58,7 @@
         GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_InvalidTime)
         return
     
+    MailType = int(gmCmdDict.get('MailType', '0'))
     Title = gmCmdDict.get('Title', '')
     Text = gmCmdDict.get('Text', '')
     GUID = gmCmdDict.get('GUID', '') # GM工具需要对全服邮件进行多服批量管理,所以这里GUID暂由GM工具决定
@@ -121,7 +122,7 @@
     #    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
     #    return
     PlayerCompensation.AddEntireItem(GUID, addItemDictList, LimitTime,
-                                     mailInfo, PlayerJob, "%s<$_$>%s<$_$>%s"%(sender, Title, Text),
+                                     mailInfo, PlayerJob, PlayerCompensation.GetMailText(Title, Text, MailType, sender),
                                      gold, goldPaper, silver, detail, serverID)
 
     #执行成功
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddPersonalCompensation.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddPersonalCompensation.py
index 8309b56..11f4b33 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddPersonalCompensation.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddPersonalCompensation.py
@@ -51,6 +51,7 @@
 def OnExec(orderId, gmCmdDict):
     strMsg = ""
     gmCmdDict = ClearEmptyFromDict(gmCmdDict)
+    GameWorld.DebugLog("GMT_AddPersonalCompensation gmCmdDict:%s" % gmCmdDict)
     queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
     if queryType == GMCommon.Def_GMKey_FamilyID:
         sendFamilyIDList = []
@@ -90,6 +91,7 @@
         GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_InvalidTime)
         return
         
+    MailType = int(gmCmdDict.get('MailType', '0'))
     Title = gmCmdDict.get('Title', '')
     Text = gmCmdDict.get('Text', '')
     GUID = str(uuid.uuid1())
@@ -118,7 +120,7 @@
     #    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
     #    return
     PlayerCompensation.AddPersonalItem(GUID, addItemDictList, PlayerIDList, 
-                                       LimitTime, "%s<$_$>%s<$_$>%s"%(sender, Title, Text),
+                                       LimitTime, PlayerCompensation.GetMailText(Title, Text, MailType, sender),
                                        gold, goldPaper, silver, detail=detail)
     
     #执行成功
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
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py
index cebf17f..10bd97f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py
@@ -138,7 +138,8 @@
         return
     
     Text = curPackData.Text
-    _, _, content = Text.split("<$_$>")
+    contentList = Text.split("<$_$>")
+    content = contentList[2] if len(contentList) > 2 else ""
     isPaimaiMail = "<MailTemplate>PaimaiMail3</MailTemplate>" in content
     
     for i in xrange(curPackData.Count):

--
Gitblit v1.8.0