From 5a5967cf491cd6ddac4a1cc5f9b9ead029212f18 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 21 十二月 2020 18:21:54 +0800
Subject: [PATCH] 8655 【GM工具】【主干】【BT】个人邮件管理,支持删除;

---
 ServerPython/db/PyMongoDataServer/GMToolLogicProcess/ProjSpecialProcess.py                     |    2 
 ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_CompensationQueryPersonal.py |   40 +++++++++++++
 ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_CompensationQueryPersonal.py    |   68 ++++++++++++++++++++++
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py                    |   45 ++++++++++++++
 4 files changed, 153 insertions(+), 2 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_CompensationQueryPersonal.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_CompensationQueryPersonal.py
new file mode 100644
index 0000000..6faacc2
--- /dev/null
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_CompensationQueryPersonal.py
@@ -0,0 +1,68 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package GM.Commands.GMT_CompensationQueryPersonal
+#
+# @todo:个人补偿查询管理
+# @author hxp
+# @date 2020-12-21
+# @version 1.0
+#
+# 详细描述: 个人补偿查询管理
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2020-12-21 19:00"""
+#-------------------------------------------------------------------------------
+
+import GMCommon
+import DataRecordPack
+import GameWorld
+import PlayerCompensation
+
+## 执行逻辑
+#  @param curPlayer 当前玩家
+#  @param gmCmdDict: 命令字典
+#  @return None
+#  @remarks 函数详细说明.
+def OnExec(orderId, gmCmdDict):
+    
+    GameWorld.DebugLog("GMT_CompensationQueryPersonal %s" % gmCmdDict)
+    PlayerIDList = eval(gmCmdDict.get('PlayerIDList', '[]'))
+    if PlayerIDList == []:
+        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
+        return
+    playerID = GameWorld.ToIntDef(PlayerIDList[0]) # 只针对单玩家处理
+    if not playerID:
+        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
+        return
+    opType = gmCmdDict.get('opType', 'query')
+    
+    # 暂仅做删除及查询
+    if opType == "del":
+        GUIDInfo = gmCmdDict.get('GUIDInfo', '')
+        if not GUIDInfo:
+            GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
+            return
+        
+        delGUIDList = GUIDInfo.split(",")
+        if not delGUIDList:
+            GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
+            return
+        curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
+        for delGUID in delGUIDList:
+            PlayerCompensation.ClearPersonalCompensation(playerID, delGUID)
+            if curPlayer:
+                PlayerCompensation.NotifyCompensationResult(curPlayer, delGUID, 1)
+    else:
+        pass
+    
+    ResultList = PlayerCompensation.QueryCompensationPersonalInfo(playerID)
+    
+    #执行成功
+    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, {"QueryCmdInfo":gmCmdDict, "ResultList":ResultList})
+    #流向
+    DataRecordPack.DR_ToolGMOperate(0, '', '', 'GMT_CompensationQueryPersonal', str(gmCmdDict))
+    return
+
+
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py
index 0df9819..876684c 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py
@@ -207,8 +207,51 @@
     limitLVType = (mailInfo - checkState * 1000000) / 100000
     return checkState, limitLVType, limitLV
 
+def QueryCompensationPersonalInfo(playerID):
+    '''个人补偿邮件查询
+    '''
+        
+    retList = []
+    compensationMgr = GameWorld.GetCompensationMgr()
+    
+    tempSign = "<MailTemplate>"
+    tempSignEnd = "</MailTemplate>"
+    curPersonalCount = compensationMgr.GetPersonalCompensationCount(playerID)
+    GameWorld.DebugLog("QueryCompensationPersonalInfo %s" % curPersonalCount)
+    for i in xrange(curPersonalCount):
+        compensation = compensationMgr.PersonalCompensationAt(playerID, i)
+        
+        contentList = compensation.Text.split("<$_$>")
+        if len(contentList) != 3:
+            continue
+        sender, title, content = contentList
+        
+        if tempSign in content and tempSignEnd in content:
+            title = content[content.index(tempSign) + len(tempSign):content.index(tempSignEnd)]
+            content = ""
+            
+        GUID = compensation.GUID
+        itemList = []
+        curGUIDItemCount = compensationMgr.FindItemCount(GUID)
+        for i in xrange(curGUIDItemCount):
+            curItem = compensationMgr.FindItemAt(GUID, i)
+            itemID = curItem.ItemID
+            if not itemID:
+                continue
+            itemList.append([itemID, curItem.Count, curItem.IsBind, curItem.UserData])
+            
+        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,
+                    "CreateTime":compensation.CreateTime, "LimitTime":compensation.LimitTime, "ItemList":itemList}
+        
+        retList.append(infoDict)
+        
+    return retList
+
 def QueryCompensationInfo(fromDate, toDate, guid, searchTitle, searchContent, searchState=None, maxCount=10):
-    '''补偿邮件查询
+    '''全服补偿邮件查询
     '''
     
     compensationMgr = GameWorld.GetCompensationMgr()
diff --git a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_CompensationQueryPersonal.py b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_CompensationQueryPersonal.py
new file mode 100644
index 0000000..0fb9a73
--- /dev/null
+++ b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_CompensationQueryPersonal.py
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package PyMongoDataServer.GMToolLogicProcess.Commands.GMT_CompensationQueryPersonal
+#
+# @todo:个人补偿查询管理
+# @author hxp
+# @date 2020-12-21
+# @version 1.0
+#
+# 详细描述: 个人补偿查询管理
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2020-12-21 19:00"""
+#-------------------------------------------------------------------------------
+
+import GMCommon
+
+## 收到gm命令执行
+# @param gmCmdDict:gm命令字典
+# @return None 
+def OnExec(gmCmdDict):
+    playerList = gmCmdDict.get("playerList", "")  #玩家列表
+    
+    if playerList == "":
+        return GMCommon.Def_ParamErr, "Please enter search player info!"               
+
+    # 回复gm参数错误
+    return GMCommon.Def_DoQueryUserDB, ''
+
+## 查询userdb返回
+# @param userdb:userdb
+# @param data:传入的信息
+# @param gmCmdDict:gm命令字典
+# @return None 
+def UserDBResponse(userdb, data, gmCmdDict):
+    return GMCommon.Def_SendToGameServer, ''
+
+
diff --git a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/ProjSpecialProcess.py b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/ProjSpecialProcess.py
index 416ce9c..3242327 100644
--- a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/ProjSpecialProcess.py
+++ b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/ProjSpecialProcess.py
@@ -251,7 +251,7 @@
     # 个人补偿GM工具
     # 由于GameServer处理多个玩家补偿同一物品时只收一次命令包处理(只插入一条物品数据)
     # 故此处先查出多个玩家账号/昵称对应的playerID,更改命令字典信息后,压入包,再推给GameServer
-    if gmCmdManger.funcName == "GMT_AddPersonalCompensation":
+    if gmCmdManger.funcName in ["GMT_AddPersonalCompensation", "GMT_CompensationQueryPersonal"]:
         gmCmdDict = gmCmdManger.gmCmdDict
         playerList = gmCmdDict.get("playerList", '')
         playerList = playerList.split(",")

--
Gitblit v1.8.0