| | |
| | | content = "<MailTemplate>%s</MailTemplate>%s" % (mailTypeKey, json.dumps(paramList, ensure_ascii=False))
|
| | | return SendPersonalItemMailEx(title, content, 30, playerIDList, addItemList, gold, goldPaper, silver, detail, moneySource)
|
| | |
|
| | | def CrossServerMsg_SendMail(msgData):
|
| | | ## 收到跨服服务器同步的发送邮件
|
| | | mailTypeKey = msgData["MailTypeKey"]
|
| | | playerIDList = msgData["Player"]
|
| | | addItemList = msgData.get("Item", [])
|
| | | paramList = msgData.get("Param", [])
|
| | | SendMailByKey(mailTypeKey, playerIDList, addItemList, paramList)
|
| | | return
|
| | |
|
| | | # 此处货币playerIDList发放统一,如根据玩家不同而变,则应需修改
|
| | | ## 功能发放物品补偿/奖励邮件
|
| | | # @param addItemList [(itemID, itemCnt, 是否拍品), {或物品信息字典}, ...]
|
| | |
| | |
|
| | | compensationDict = {"GUID":GUID, "CheckState":checkState, "LimitLVType":limitLVType, "LimitLV":limitLV,
|
| | | "Gold":compensation.Gold, "GoldPaper":compensation.GoldPaper, "Silver":compensation.Silver,
|
| | | "PlayerJob":compensation.PlayerJob, "Sender":sender, "Title":title, "Content":content,
|
| | | "PlayerJob":compensation.PlayerJob, "Sender":sender, "Title":title, "Content":content, "OnlyServerID":compensation.ServerID,
|
| | | "CreateTime":compensation.CreateTime, "LimitTime":compensation.LimitTime, "ItemList":itemList}
|
| | | return compensationDict
|
| | |
|
| | |
| | | SyncQueryCompensationResult(player, notifyList)
|
| | |
|
| | | return successGUIDList
|
| | |
|
| | | def SendEntireMail(mailTypeKey, getDays, limitLV, limitLVType, addItemList=[], paramList=[], \
|
| | | gold=0, goldPaper=0, silver=0, detail="", moneySource=ChConfig.Def_GiveMoney_Mail, GUID=""):
|
| | | ''' 发送全服邮件
|
| | | @param mailTypeKey: 邮件模板key
|
| | | @param getDays: 有效天数
|
| | | @param limitLV: 领取最低等级限制
|
| | | @param limitLVType: 等级不足的升级后是否可领 0-不可,1-可以
|
| | | '''
|
| | | |
| | | if not mailTypeKey or getDays <= 0:
|
| | | return
|
| | | |
| | | addItemDictList = []
|
| | | for itemInfo in addItemList:
|
| | | if isinstance(itemInfo, dict):
|
| | | addItemDictList.append(itemInfo)
|
| | | continue
|
| | | |
| | | if len(itemInfo) == 3:
|
| | | itemID, itemCnt, isAuctionItem = itemInfo
|
| | | else:
|
| | | continue
|
| | | |
| | | addItemDict = {}
|
| | | addItemDict['ItemID'] = itemID
|
| | | addItemDict['Count'] = itemCnt
|
| | | addItemDict['IsAuctionItem'] = isAuctionItem
|
| | | addItemDictList.append(addItemDict)
|
| | | |
| | | if not GUID:
|
| | | GUID = str(uuid.uuid1())
|
| | | |
| | | limitTime = str(GameWorld.GetDatetimeByDiffDays(getDays))
|
| | | limitTime = limitTime.split(".")[0]
|
| | | |
| | | sender = ChConfig.Def_Mail_SenderSys
|
| | | title = ""
|
| | | content = "<MailTemplate>%s</MailTemplate>%s" % (mailTypeKey, json.dumps(paramList, ensure_ascii=False))
|
| | | |
| | | checkState = 0 # 邮件审核状态,为兼容老邮件,默认0-已审核,1-未审核
|
| | | mailInfo = GetEntireCompensationInfo(checkState, limitLVType, limitLV)
|
| | | PlayerJob = 127 # 默认全职业可领
|
| | | serverID = 0 # 默认所有服务器ID
|
| | | |
| | | AddEntireItem(GUID, addItemDictList, limitTime, mailInfo, PlayerJob, "%s<$_$>%s<$_$>%s" % (sender, title, content), |
| | | gold, goldPaper, silver, detail, serverID)
|
| | | return
|
| | |
|
| | | ## 添加全服补偿
|
| | | # @param addItemDictList, LimitTime, mailInfo, PlayerJob, Text
|
| | |
| | | SetPrizeState(curPlayerID, curRequire.GUID, Disable_State, readState)
|
| | | continue
|
| | |
|
| | | if curRequire.ServerID and curRequire.ServerID != GameWorld.GetPlayerServerID(curPlayer):
|
| | | # 指定服务器邮件
|
| | | SetPrizeState(curPlayerID, curRequire.GUID, Disable_State, readState)
|
| | | continue
|
| | | |
| | | #可以用的奖励
|
| | | if Enable_State != curState:
|
| | | SetPrizeState(curPlayerID, curRequire.GUID, Enable_State, readState)
|
| | |
| | | # @return None
|
| | | def SendGMRequestCompensationResult(routeIndex, mapID, curPlayer, GUID, compensationType, curEntireRequire):
|
| | |
|
| | | Text, gold, goldPaper, silver, moneySource, createTime = curEntireRequire.Text, curEntireRequire.Gold, \
|
| | | curEntireRequire.GoldPaper, curEntireRequire.Silver, curEntireRequire.Type, curEntireRequire.CreateTime
|
| | | Text, gold, goldPaper, silver, createTime = curEntireRequire.Text, curEntireRequire.Gold, \
|
| | | curEntireRequire.GoldPaper, curEntireRequire.Silver, curEntireRequire.CreateTime
|
| | | # 全服邮件没有 Type 字段
|
| | | moneySource = curEntireRequire.Type if compensationType == Personal_CompensationType else 0
|
| | | |
| | | sendPack = ChGameToMapPyPack.tagGMRequestCompensationResult()
|
| | | sendPack.PlayerID = curPlayer.GetID()
|
| | | sendPack.CompensationType = compensationType
|
| | |
| | | return
|
| | |
|
| | |
|
| | | ##清理超时30天的个人邮件, 否则流失玩家在不断合服情况下数据会累积
|
| | | # 个人邮件暂无过期时间设定,只有30天清理逻辑,以创建时间为准
|
| | | # @param None
|
| | | # @return None
|
| | | def ClearUpPersonalCompensation():
|
| | | #校验过期补偿
|
| | | curTime = datetime.datetime.today()
|
| | | needClearGUIDList = []
|
| | | allCnt = GameWorld.GetCompensationMgr().GetAllPersonalCompensationCount()
|
| | | for i in xrange(allCnt):
|
| | | curMail = GameWorld.GetCompensationMgr().AtAllPersonalCompensation(i)
|
| | | # 超过接收邮件30天则完全删除此邮件
|
| | | limitTime = datetime.datetime.strptime(curMail.CreateTime, ChConfig.TYPE_Time_Format) + datetime.timedelta(days = 30)
|
| | | if limitTime < curTime:
|
| | | needClearGUIDList.append([curMail.PlayerID, curMail.GUID])
|
| | | |
| | | GameWorld.Log("ClearUpPersonalCompensation count=%s"%len(needClearGUIDList))
|
| | | |
| | | #删除过期补偿信息, 没有主动通知在线玩家
|
| | | for playerID, GUID in needClearGUIDList:
|
| | | ClearPersonalCompensation(playerID, GUID)
|
| | | return
|
| | |
|
| | | ## 清理超时补偿, 个人邮件在超过上限后才会自动删除
|
| | | # @param None
|
| | | # @return None
|
| | | def ClearUpTimeOutCompensation():
|
| | |
|
| | | ClearUpPersonalCompensation()
|
| | | ClearUpEntireCompensation()
|
| | | return
|
| | |
|