16 卡牌服务端(GMT命令个人邮件、全服邮件相关;)
| | |
| | | self.__memberList.append(member)
|
| | | return member
|
| | |
|
| | | def GetMemberIDList(self): return self.__memberDict.keys()
|
| | | |
| | | def AddMember(self, playerID):
|
| | | member = None
|
| | | if playerID in self.__memberDict:
|
| | |
| | | itemObj = MailItem()
|
| | | return itemObj
|
| | |
|
| | | def GetMailItemList(self, guid):
|
| | | if guid not in self.__mailItemDict:
|
| | | return []
|
| | | itemList = []
|
| | | for mailItem in self.__mailItemDict[guid]:
|
| | | itemID = mailItem.GetItemID()
|
| | | itemCount = mailItem.GetCount()
|
| | | isBind = mailItem.GetIsBind()
|
| | | userData = mailItem.GetUserData()
|
| | | itemInfo = [itemID, itemCount, isBind]
|
| | | if userData:
|
| | | itemInfo.append(userData)
|
| | | itemList.append(itemInfo)
|
| | | return itemList
|
| | | |
| | | def AddServerMail(self, guid, title, text, itemList, limitDays=7, mailType=0):
|
| | | '''添加个人邮件
|
| | | @param guid: 指定的邮件guid,为空时自动生成新guid
|
| | | @param itemList: 元素支持字典{k:v, ...} 或列表 [itemID, itemCount, 可选是否拍品, 物品UserData]
|
| | | '''
|
| | | mailObj = None
|
| | | if not guid:
|
| | | guid = GameWorld.GetGUID()
|
| | | if guid in self.__serverMailDict:
|
| | | # 已经存在的guid不允许重复插入全服邮件,防止多领取,后台发送全服邮件时如果重复推送到某个服务器就可能存在重复情况
|
| | | return mailObj
|
| | | dbData = DBStruct.tagDBMailServer()
|
| | | dbData.GUID = guid
|
| | | dbData.Type = mailType
|
| | |
| | | SendEventPack("MailDel", dataDict)
|
| | | return
|
| | |
|
| | | def DR_ServerMail(GUID, eventName, addDict={}):
|
| | | ## 全服邮件流向
|
| | | dataDict = {'GUID':GUID, "eventName":eventName}
|
| | | dataDict.update(addDict)
|
| | | SendEventPack("MailServerMail", dataDict)
|
| | | return
|
| | |
|
| | | def DR_CreateRole(playerData):
|
| | | dataDict = {'PlayerID':playerData.PlayerID, 'AccID':playerData.AccID, 'PlayerName':playerData.PlayerName, "Job":playerData.Job}
|
| | | #发送封包
|
| | | SendEventPack("CreateRole", dataDict)
|
| | | return |
| | |
|
| | |
| | | DataRecordPack.DR_MailDel(playerID, guid, "GMDel")
|
| | | notifyGUIDState[guid] = ShareDefine.MailState_Del
|
| | | GameWorld.DebugAnswer(curPlayer, "删除个人邮件:%s" % len(guidList))
|
| | | PlayerMail.Sync_PlayerMailState(curPlayer, notifyGUIDState)
|
| | |
|
| | | guidList = mailMgr.GetServerMailGuids()
|
| | | for guid in guidList:
|
| | | playerStateDict = mailMgr.DelServerMail(guid)
|
| | | if playerID in playerStateDict and playerStateDict[playerID] < ShareDefine.MailState_Del:
|
| | | notifyGUIDState[guid] = ShareDefine.MailState_Del
|
| | | PlayerMail.DelServerMail(guid, "GMDel")
|
| | | if len(guidList):
|
| | | GameWorld.DebugAnswer(curPlayer, "删除全服邮件:%s" % len(guidList))
|
| | | PlayerMail.Sync_PlayerMailState(curPlayer, notifyGUIDState)
|
| | | return
|
| | |
|
| | | def PrintPlayerMail(curPlayer):
|
| | |
| | | #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()
|
| | |
| | | @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):
|
| | | ## 审核全服邮件结果
|
| | |
| | | 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
|
| | |
|
| | |
| | | Sync_PlayerMailState(curPlayer, notifyGUIDState)
|
| | | return
|
| | |
|
| | | def doMailDel(curPlayer, guid, isGM=False):
|
| | | def doMailDel(curPlayer, guid, isGM=False, playerID=0):
|
| | | ## 执行邮件删除
|
| | | # @param isGM: 是否GM删除,无视物品是否已领取,强制删除
|
| | |
|
| | | if curPlayer:
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | mailMgr = DBDataMgr.GetMailMgr()
|
| | |
|
| | |
| | | DataRecordPack.DR_MailDel(playerID, guid, "GMDel")
|
| | | # 这里玩家主动删除的可不记录流向,因为未读未领取不允许主动删除,已领取的已有领取记录,所以可不记录
|
| | |
|
| | | if curPlayer:
|
| | | Sync_PlayerMailState(curPlayer, notifyGUIDState)
|
| | | return
|
| | |
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_AddEntireCompensation
|
| | | #
|
| | | # @todo:GM工具命令 - 添加全服邮件
|
| | | # @author hxp
|
| | | # @date 2025-06-04
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: GM工具命令 - 添加全服邮件
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-06-04 15:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import PlayerMail
|
| | | import DataRecordPack
|
| | | import GMT_AddPersonalCompensation
|
| | | import GMCommon
|
| | |
|
| | | ## 执行逻辑
|
| | | # @param curPlayer 当前玩家
|
| | | # @param gmCmdDict: 命令字典
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def OnExec(gmCmdDict):
|
| | | |
| | | LimitDays = int(gmCmdDict.get('LimitDays', '7'))
|
| | | MailType = int(gmCmdDict.get('MailType', '0'))
|
| | | Title = gmCmdDict.get('Title', '')
|
| | | Text = gmCmdDict.get('Text', '')
|
| | | GUID = gmCmdDict.get('GUID', '') # GM工具需要对全服邮件进行多服批量管理,所以这里GUID暂由GM工具决定
|
| | | |
| | | if GUID.startswith("{") and GUID.endswith("}"):
|
| | | GUID = GUID[1:-1]
|
| | | if not GUID:
|
| | | return GMCommon.Def_ParamErr
|
| | | |
| | | limitLV = min(99999, int(gmCmdDict.get('PlayerLV', '0'))) # 支持的最大等级
|
| | | limitLVType = int(gmCmdDict.get('LimitLVType', '0')) # 原先未达到邮件领取等级的玩家之后升级上来是否可领取邮件, 默认0-不可,1-可以
|
| | | checkState = int(gmCmdDict.get('CheckState', '0')) # 邮件审核状态,为兼容老邮件,默认0-已审核,1-未审核
|
| | | itemList = GMT_AddPersonalCompensation.GetGMTMailItemList(gmCmdDict)
|
| | | |
| | | mailObj = PlayerMail.SendSeverMail(GUID, Title, Text, itemList, LimitDays, MailType, limitLV, limitLVType, checkState)
|
| | | if not mailObj:
|
| | | return GMCommon.Def_ParamErr, "GUID is exist."
|
| | | |
| | | # 流向
|
| | | GMT_Name = gmCmdDict.get(GMCommon.Def_GMKey_Type, '')
|
| | | DataRecordPack.DR_ToolGMOperate(0, '', '', GMT_Name, str(gmCmdDict))
|
| | | return GMCommon.Def_Success, {"GUID":GUID}
|
| | |
|
| | |
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | ##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_AddPersonalCompensation
|
| | | #
|
| | | ##@package PyMongoDataServer.GMToolLogicProcess.Commands.GMT_AddPersonalCompensation
|
| | | #
|
| | | # @todo:个人补偿 - 新
|
| | | # @todo:GM工具命令 - 添加个人邮件
|
| | | # @author hxp
|
| | | # @date 2014-09-23
|
| | | # @date 2025-06-04
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 个人补偿 - 新
|
| | | # 详细描述: GM工具命令 - 添加个人邮件
|
| | | #
|
| | | #---------------------------------------------------------------------
|
| | | """Version = 2014-09-23 12:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-06-04 15:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | | import GMCommon
|
| | | #---------------------------------------------------------------------
|
| | | #全局变量
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | import DataRecordPack
|
| | | import PlayerMail
|
| | |
|
| | | ## 收到gm命令执行
|
| | | # @param gmCmdDict:gm命令字典
|
| | | # @return None
|
| | | def OnExec(gmCmdDict):
|
| | | playerList = gmCmdDict.get("playerList", "") #玩家列表
|
| | | from GMToolLogicProcess import ProjSpecialProcess
|
| | | ret = ProjSpecialProcess.GMCmdPlayerListValidationID(gmCmdDict)
|
| | | Result = ret[0]
|
| | | if Result != GMCommon.Def_Success:
|
| | | return Result, ret[1]
|
| | | playerIDList = ret[1]
|
| | |
|
| | | if playerList == "":
|
| | | return GMCommon.Def_ParamErr, "Please enter search player info!" |
| | | LimitDays = int(gmCmdDict.get('LimitDays', '7'))
|
| | | MailType = int(gmCmdDict.get('MailType', '0'))
|
| | | Title = gmCmdDict.get('Title', '')
|
| | | Text = gmCmdDict.get('Text', '')
|
| | | itemList = GetGMTMailItemList(gmCmdDict)
|
| | |
|
| | | # 回复gm参数错误
|
| | | return GMCommon.Def_DoQueryUserDB, ''
|
| | | for playerID in playerIDList:
|
| | | PlayerMail.SendMail(playerID, Title, Text, itemList, LimitDays, MailType)
|
| | |
|
| | | ## 查询userdb返回
|
| | | # @param userdb:userdb
|
| | | # @param data:传入的信息
|
| | | # @param gmCmdDict:gm命令字典
|
| | | # @return None |
| | | def UserDBResponse(userdb, data, gmCmdDict):
|
| | | return GMCommon.Def_SendToGameServer, ''
|
| | | # 流向
|
| | | GMT_Name = gmCmdDict.get(GMCommon.Def_GMKey_Type, '')
|
| | | DataRecordPack.DR_ToolGMOperate(0, '', '', GMT_Name, str(gmCmdDict))
|
| | | return GMCommon.Def_Success
|
| | |
|
| | | def GetGMTMailItemList(gmCmdDict):
|
| | |
|
| | | #工具发过来的物品下标依据 'index,index,...' 不一定是从0开始并按顺序连续 =_=#
|
| | | intemIndexStrList = []
|
| | | itemNums = gmCmdDict.get('itemNums', '')
|
| | | if itemNums.strip() != '':
|
| | | intemIndexStrList = itemNums.split(',')
|
| | | #添加物品
|
| | | itemList = []
|
| | | for itemIndexStr in intemIndexStrList:
|
| | | itemID = GameWorld.ToIntDef(gmCmdDict.get('ItemID%s' % itemIndexStr, '0'))
|
| | | if not itemID:
|
| | | continue
|
| | | itemCount = GameWorld.ToIntDef(gmCmdDict.get('ItemCnt%s' % itemIndexStr, '0'))
|
| | | if not itemCount:
|
| | | continue
|
| | | isBind = GameWorld.ToIntDef(gmCmdDict.get('IsBind%s' % itemIndexStr, '0'))
|
| | | |
| | | #添加到物品信息列表
|
| | | itemList.append([itemID, itemCount, isBind])
|
| | | |
| | | GameWorld.DebugLog("GetGMTMailItemList %s" % itemList)
|
| | | return itemList
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_CompensationMgr
|
| | | #
|
| | | # @todo:GM工具命令 - 全服邮件管理
|
| | | # @author hxp
|
| | | # @date 2025-06-04
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: GM工具命令 - 全服邮件管理
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-06-04 15:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GMCommon
|
| | | import GameWorld
|
| | | import DataRecordPack
|
| | | import PlayerMail
|
| | |
|
| | | ## 执行逻辑
|
| | | # @param curPlayer 当前玩家
|
| | | # @param gmCmdDict: 命令字典
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def OnExec(gmCmdDict):
|
| | | |
| | | GUIDInfo = gmCmdDict.get('GUIDInfo', '')
|
| | | operation = GameWorld.ToIntDef(gmCmdDict.get('operation', 0)) # 1-通过;2-删除
|
| | | if not GUIDInfo:
|
| | | return GMCommon.Def_ParamErr
|
| | | operGUIDList = GUIDInfo.split(",")
|
| | | if not operGUIDList:
|
| | | return GMCommon.Def_ParamErr
|
| | | |
| | | if operation not in [1, 2]:
|
| | | return GMCommon.Def_ParamErr
|
| | | |
| | | isOK = (operation == 1)
|
| | | for GUID in operGUIDList:
|
| | | PlayerMail.CheckServerMailResult(GUID, isOK)
|
| | | |
| | | #流向
|
| | | GMT_Name = gmCmdDict.get(GMCommon.Def_GMKey_Type, '') |
| | | DataRecordPack.DR_ToolGMOperate(0, '', '', GMT_Name, str(gmCmdDict))
|
| | | return GMCommon.Def_Success
|
| | |
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_CompensationQuery
|
| | | #
|
| | | # @todo:GM工具命令 - 全服邮件查询
|
| | | # @author hxp
|
| | | # @date 2025-06-04
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: GM工具命令 - 全服邮件查询
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-06-04 15:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | | import DBDataMgr
|
| | | import GMCommon
|
| | |
|
| | | ## 执行逻辑
|
| | | # @param curPlayer 当前玩家
|
| | | # @param gmCmdDict: 命令字典
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def OnExec(gmCmdDict):
|
| | | |
| | | fromDate = gmCmdDict.get('FromDate', '')
|
| | | toDate = gmCmdDict.get('ToDate', '')
|
| | | guid = gmCmdDict.get('GUID', '')
|
| | | searchTitle = gmCmdDict.get('SearchTitle', '')
|
| | | searchContent = gmCmdDict.get('SearchContent', '')
|
| | | searchState = GameWorld.ToIntDef(gmCmdDict.get('SearchState')) # 0-全部;1-通过;2-未审
|
| | | if searchState == 1:
|
| | | searchState = 0
|
| | | elif searchState == 2:
|
| | | searchState = 1
|
| | | else:
|
| | | searchState = None
|
| | | maxCount = GameWorld.ToIntDef(gmCmdDict.get('MaxCount', ''), 5)
|
| | | maxCount = min(50, maxCount)
|
| | | |
| | | mailMgr = DBDataMgr.GetMailMgr()
|
| | | queryRetList = []
|
| | | if guid:
|
| | | mailObj = mailMgr.GetServerMail(guid)
|
| | | queryRetList.append(__getServerMailInfo(mailObj, mailMgr.GetMailItemList(guid)))
|
| | | else:
|
| | | if fromDate:
|
| | | fromDate = "%s 00:00:00" % fromDate
|
| | | if toDate:
|
| | | toDate = "%s 23:59:59" % toDate
|
| | | |
| | | for guid in mailMgr.GetServerMailGuids():
|
| | | mailObj = mailMgr.GetServerMail(guid)
|
| | | if fromDate and mailObj.GetCreateTime() < fromDate:
|
| | | continue
|
| | | |
| | | if toDate and mailObj.GetCreateTime() > toDate:
|
| | | continue
|
| | | |
| | | if searchTitle and searchTitle not in mailObj.GetTitle():
|
| | | continue
|
| | | |
| | | if searchContent and searchContent not in mailObj.GetText():
|
| | | continue
|
| | | |
| | | if searchState != None and searchState != mailObj.GetCheckState():
|
| | | continue
|
| | | |
| | | queryRetList.append(__getServerMailInfo(mailObj, mailMgr.GetMailItemList(guid)))
|
| | | if len(queryRetList) >= maxCount:
|
| | | break
|
| | | |
| | | queryRetList.sort(key=lambda m:(m["CreateTime"]), reverse=True)
|
| | | |
| | | return GMCommon.Def_Success, queryRetList
|
| | |
|
| | | def __getServerMailInfo(mailObj, itemList):
|
| | | return {"GUID":mailObj.GetGUID(), "CheckState":mailObj.GetCheckState(), "LimitLVType":mailObj.GetLimitLVType(), |
| | | "LimitLV":mailObj.GetLimitLV(), "MailType":mailObj.GetType(), "Title":mailObj.GetTitle(), "Content":mailObj.GetText(),
|
| | | "CreateTime":mailObj.GetCreateTime(), "LimitDays":mailObj.GetLimitDays(), "ItemList":itemList}
|
| | | |
| | |
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package PyMongoDataServer.GMToolLogicProcess.Commands.GMT_CompensationQueryPersonal
|
| | | ##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_CompensationQueryPersonal
|
| | | #
|
| | | # @todo:个人补偿查询管理
|
| | | # @todo:GM工具命令 - 个人邮件查询管理
|
| | | # @author hxp
|
| | | # @date 2020-12-21
|
| | | # @date 2025-06-04
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 个人补偿查询管理
|
| | | # 详细描述: GM工具命令 - 个人邮件查询管理
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2020-12-21 19:00"""
|
| | | #"""Version = 2025-06-04 15:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GMCommon
|
| | | import GameWorld
|
| | | import DataRecordPack
|
| | | import PlayerMail
|
| | | import DBDataMgr
|
| | |
|
| | | ## 收到gm命令执行
|
| | | # @param gmCmdDict:gm命令字典
|
| | | # @return None
|
| | | def OnExec(gmCmdDict):
|
| | | playerList = gmCmdDict.get("playerList", "") #玩家列表
|
| | |
|
| | | if playerList == "":
|
| | | return GMCommon.Def_ParamErr, "Please enter search player info!" |
| | | errorMsg = ""
|
| | | from GMToolLogicProcess import ProjSpecialProcess
|
| | | Result, playerID = ProjSpecialProcess.GMCmdPlayerValidationID(gmCmdDict)
|
| | | if Result != GMCommon.Def_Success:
|
| | | return Result, errorMsg
|
| | |
|
| | | # 回复gm参数错误
|
| | | return GMCommon.Def_DoQueryUserDB, ''
|
| | | Result = GMCommon.Def_Unknow
|
| | |
|
| | | ## 查询userdb返回
|
| | | # @param userdb:userdb
|
| | | # @param data:传入的信息
|
| | | # @param gmCmdDict:gm命令字典
|
| | | # @return None |
| | | def UserDBResponse(userdb, data, gmCmdDict):
|
| | | return GMCommon.Def_SendToGameServer, ''
|
| | | opType = gmCmdDict.get('opType', 'query')
|
| | |
|
| | | # 暂仅做删除及查询
|
| | | if opType == "del":
|
| | | GUIDInfo = gmCmdDict.get('GUIDInfo', '')
|
| | | if not GUIDInfo:
|
| | | return GMCommon.Def_ParamErr
|
| | |
|
| | | delGUIDList = GUIDInfo.split(",")
|
| | | if not delGUIDList:
|
| | | return GMCommon.Def_ParamErr
|
| | | |
| | | curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | for delGUID in delGUIDList:
|
| | | PlayerMail.doMailDel(curPlayer, delGUID, True, playerID)
|
| | | |
| | | else:
|
| | | pass
|
| | | |
| | | mailList = __queryMailInfoList(playerID)
|
| | | |
| | | #流向
|
| | | if opType == "del":
|
| | | GMT_Name = gmCmdDict.get(GMCommon.Def_GMKey_Type, '') |
| | | DataRecordPack.DR_ToolGMOperate(0, '', '', GMT_Name, str(gmCmdDict))
|
| | | return GMCommon.Def_Success, {"mailList":mailList}
|
| | | |
| | | def __queryMailInfoList(playerID):
|
| | | '''个人补偿邮件查询
|
| | | '''
|
| | | |
| | | mailList = []
|
| | | mailMgr = DBDataMgr.GetMailMgr()
|
| | | guids = mailMgr.GetPersonalMailGuids(playerID)
|
| | | for guid in guids:
|
| | | mailObj = mailMgr.GetPersonalMail(playerID, guid)
|
| | | if not mailObj:
|
| | | continue
|
| | | title = mailObj.GetTitle()
|
| | | content = mailObj.GetText()
|
| | | mailType = mailObj.GetType()
|
| | | createTime = mailObj.GetCreateTime()
|
| | | limitDays = mailObj.GetLimitDays()
|
| | | mailState = mailObj.GetMailState()
|
| | | |
| | | if "<T>" in title:
|
| | | title = title[3:-4]
|
| | | |
| | | itemList = mailMgr.GetMailItemList(guid)
|
| | | infoDict = {"GUID":guid, "Title":title, "Content":content, "State":mailState, "MailType":mailType,
|
| | | "CreateTime":createTime, "LimitDays":limitDays, "ItemList":itemList}
|
| | | mailList.append(infoDict)
|
| | | |
| | | mailList.sort(key=lambda m:(m["CreateTime"]), reverse=True)
|
| | | return mailList
|
| | |
| | | import PlayerOfflineSupport
|
| | | import PyGameData
|
| | | import GameWorld
|
| | | import DBDataMgr
|
| | |
|
| | | ##################################################################
|
| | | ####### python逻辑入口 #######
|
| | |
| | |
|
| | | ##################################################################
|
| | |
|
| | | def GMCmdPlayerListValidationID(gmCmdDict):
|
| | | '''后台GM工具玩家列表命令通用验证
|
| | | @param gmCmdDict: 命令参数字典
|
| | | @return: GMCommon.Def_xxx, idList or errorInfo
|
| | | 非 Def_Success 的错误类型 - 代表错误,可直接返回给后台
|
| | | Def_Success, playerIDList - 待处理的玩家ID列表
|
| | | '''
|
| | | playerList = gmCmdDict.get("playerList", '')
|
| | | playerList = playerList.split(",")
|
| | | if not playerList:
|
| | | return GMCommon.Def_ParamErr, ""
|
| | | |
| | | playerIDList = []
|
| | | queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') |
| | | if queryType in [GMCommon.Def_GMKey_PlayerName, GMCommon.Def_GMKey_PlayerAccID]:
|
| | | for playerFind in playerList:
|
| | | if queryType == GMCommon.Def_GMKey_PlayerName:
|
| | | rec = PyGameData.g_usrCtrlDB.findDBPlayerByName(playerFind)
|
| | | elif queryType == GMCommon.Def_GMKey_PlayerAccID:
|
| | | rec = PyGameData.g_usrCtrlDB.findDBPlayerByAccID(playerFind)
|
| | | else:
|
| | | continue
|
| | | |
| | | if not rec:
|
| | | # db找不到就是不存在该玩家
|
| | | return GMCommon.Def_NoTag, "%s can not found!" % str(playerFind)
|
| | | |
| | | playerID = rec.get(u'PlayerID', 0)
|
| | | playerIDList.append(playerID)
|
| | | |
| | | elif queryType == GMCommon.Def_GMKey_FamilyID:
|
| | | # 根据家族ID的直接返回
|
| | | familyMgr = DBDataMgr.GetFamilyMgr()
|
| | | for familyID in eval(playerList):
|
| | | familyID = GameWorld.ToIntDef(familyID)
|
| | | family = familyMgr.FindFamily(familyID)
|
| | | if not family:
|
| | | GameWorld.DebugLog(" not family %s" % familyID)
|
| | | continue
|
| | | memberIDList = family.GetMemberIDList()
|
| | | playerIDList += memberIDList
|
| | | |
| | | if not playerIDList:
|
| | | return GMCommon.Def_ParamErr, ""
|
| | | |
| | | return GMCommon.Def_Success, playerIDList
|
| | |
|
| | | def GMCmdPlayerValidationID(gmCmdDict):
|
| | | '''后台GM工具玩家命令通用验证
|
| | | @param gmCmdDict: 命令参数字典
|
| | | @return: GMCommon.Def_xxx, playerID
|
| | | 非 Def_Success 的错误类型 - 代表错误,可直接返回给后台
|
| | | Def_Success, playerID - 本服玩家ID
|
| | | '''
|
| | | |
| | | queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
|
| | | playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')
|
| | | |
| | | if len(playerFind) <= 0:
|
| | | return GMCommon.Def_ParamErr, None
|
| | | |
| | | # 玩家姓名
|
| | | if queryType == GMCommon.Def_GMKey_PlayerName:
|
| | | rec = PyGameData.g_usrCtrlDB.findDBPlayerByName(playerFind)
|
| | | elif queryType == GMCommon.Def_GMKey_PlayerAccID:
|
| | | rec = PyGameData.g_usrCtrlDB.findDBPlayerByAccID(playerFind)
|
| | | else:
|
| | | return GMCommon.Def_ParamErr, None
|
| | | |
| | | if not rec:
|
| | | # db找不到就是不存在该玩家
|
| | | return GMCommon.Def_NoTag, None
|
| | | |
| | | playerID = rec.get(u'PlayerID', 0)
|
| | | return GMCommon.Def_Success, playerID
|
| | |
|
| | | def GMCmdPlayerValidation(gmCmdDict, offlineSupport=True):
|
| | | '''后台GM工具玩家命令通用验证
|
| | | @param gmCmdDict: 命令参数字典
|
| | |
| | | def GMToolCommand(self):
|
| | | callFunc = GetExecFunc(Commands, "%s.%s"%(self.funcName, "OnExec"))
|
| | |
|
| | | execType = GMCommon.Def_SendToGameServer
|
| | | execType = GMCommon.Def_Unknow
|
| | | execInfo = ''
|
| | | if callFunc != None:
|
| | | execType, execInfo = callFunc(self.gmCmdDict)
|
| | | ret = callFunc(self.gmCmdDict)
|
| | | if isinstance(ret, int):
|
| | | execType = ret
|
| | | elif isinstance(ret, tuple):
|
| | | execType = ret[0]
|
| | | execInfo = ret[1]
|
| | |
|
| | | GetGMOrderMgr().PopCmd(self.orderId)
|
| | | GMCommandResult(self.orderId, self.funcName, execType, execInfo)
|