From 16c082422d5f3c31ca3121bfd2d8f773932f19a5 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 30 八月 2021 17:01:18 +0800
Subject: [PATCH] 5076 【主干】【gt_1.101.1】【BT3】【bt3_1.100.1】合服后玩家上线没收到合服邮件(优化登录异常时发邮件逻辑)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py      |    3 +--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py |   20 ++++++++++----------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index 355f352..b861f5c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -186,7 +186,6 @@
 #===============================================================================
     #初始化物品
     #ChItem.InitPlayerLoginItem(curPlayer, tick)
-    PlayerControl.ClearUnLoginOKPlayerMailCache(curPlayer.GetPlayerID())
     return
 #---------------------------------------------------------------------
 ##C++封包GameServer_InitOK 处理
@@ -927,8 +926,8 @@
             break
     detailDict = {"MixServerWorldLV":mixServerWorldLV, "LastMixServerDay":lastMixServerDay, "ItemWorldLV":itemWorldLV}
     addItemList = mailItemList + worldLVItemList
-    PlayerControl.SendMailByKey("MixServer1", [playerID], addItemList, gold=gold, silver=silver, detail=detailDict)
     GameWorld.Log("    发送合服补偿邮件: itemWorldLV=%s,addItemList=%s" % (itemWorldLV, addItemList), playerID)
+    PlayerControl.SendMailByKey("MixServer1", [playerID], addItemList, gold=gold, silver=silver, detail=detailDict)
     
     # 同步排行榜
     PlayerBillboard.UpdatePlayerBillboardOnLeaveServer(curPlayer, isAll=True)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
index ef151d0..98727d6 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -444,17 +444,18 @@
     if playerID not in PyGameData.g_unLoginOKPlayerMailInfo:
         PyGameData.g_unLoginOKPlayerMailInfo[playerID] = []
     mailList = PyGameData.g_unLoginOKPlayerMailInfo[playerID]
+    if [cacheType, mailInfo] in mailList:
+        GameWorld.Log("###重复添加GetGameServerInitOK未登录成功的玩家个人邮件发送缓存! 不添加! mailCount=%s, mailInfo=%s" 
+                      % (len(mailList), str(mailInfo)), playerID)
+        return
+    if len(mailList) >= 10: # 做个限制,防止出问题刷邮件
+        GameWorld.Log("###限制添加GetGameServerInitOK未登录成功的玩家个人邮件发送缓存! 超出最大可添加数,不添加! mailCount=%s, mailInfo=%s" 
+                      % (len(mailList), str(mailInfo)), playerID)
+        return
     mailList.append([cacheType, mailInfo])
     # curPlayer.GetGameServerInitOK()
-    GameWorld.Log("添加GetGameServerInitOK未登录成功的玩家个人邮件发送缓存! mailCount=%s, %s" % (len(mailList), str(PyGameData.g_unLoginOKPlayerMailInfo)), playerID)
-    return
-
-def ClearUnLoginOKPlayerMailCache(playerID):
-    ## 清除未登录成功的玩家个人邮件发送缓存
-    if playerID not in PyGameData.g_unLoginOKPlayerMailInfo:
-        return
-    PyGameData.g_unLoginOKPlayerMailInfo.pop(playerID)
-    GameWorld.Log("清除未登录成功的玩家个人邮件发送缓存!", playerID)
+    GameWorld.Log("添加GetGameServerInitOK未登录成功的玩家个人邮件发送缓存! 等待发送! mailCount=%s, mailInfo=%s" 
+                  % (len(mailList), str(mailInfo)), playerID)
     return
 
 def SendUnLoginOKPlayerMailCache(curPlayer):
@@ -1330,7 +1331,6 @@
     PyGameData.g_playerEquipPartAttrDict.pop(playerID, None)
     PyGameData.g_equipChangeClassLVInfo.pop(playerID, None)
     NPCCommon.ClearPriWoodPile(curPlayer)
-    ClearUnLoginOKPlayerMailCache(playerID)
     return
 
 ##更新保存玩家在线时间

--
Gitblit v1.8.0