| | |
| | | if not mailObj:
|
| | | continue
|
| | | createTime = GameWorld.ChangeTimeStrToNum(mailObj.GetCreateTime())
|
| | | limitTime = createTime + (mailObj.GetLimitDays() + 7) * 3600 * 24
|
| | | if curTime < limitTime:
|
| | | #GameWorld.DebugLog("全服邮件未超时,不删除! %s,createTime=%s,limitTime=%s" % (guid, mailObj.GetCreateTime(), GameWorld.ChangeTimeNumToStr(limitTime)))
|
| | | passDays = GameWorld.GetDiff_Day(curTime, createTime) + 1 # 过期判断按0点算天数
|
| | | limitDays = mailObj.GetLimitDays()
|
| | | if passDays <= limitDays:
|
| | | #GameWorld.DebugLog("全服邮件未超时,不删除! %s,createTime=%s,passDays=%s <= limitDays=%s" % (guid, mailObj.GetCreateTime(), passDays, limitDays))
|
| | | continue
|
| | |
|
| | | DelServerMail(guid, "Timeout")
|
| | |
| | | notifyGUIDState = {}
|
| | | for guid, mailObj in mailDict.items():
|
| | | createTime = GameWorld.ChangeTimeStrToNum(mailObj.GetCreateTime())
|
| | | limitTime = createTime + (mailObj.GetLimitDays() + 0) * 3600 * 24
|
| | | if curTime < limitTime:
|
| | | #GameWorld.DebugLog("个人邮件未超时,不删除! %s,createTime=%s,limitTime=%s" % (guid, mailObj.GetCreateTime(), GameWorld.ChangeTimeNumToStr(limitTime)), playerID)
|
| | | passDays = GameWorld.GetDiff_Day(curTime, createTime) + 1 # 过期判断按0点算天数
|
| | | limitDays = mailObj.GetLimitDays()
|
| | | if passDays <= limitDays:
|
| | | #GameWorld.DebugLog("个人邮件未超时,不删除! %s,createTime=%s,passDays=%s <= limitDays=%s" % (guid, mailObj.GetCreateTime(), passDays, limitDays), playerID)
|
| | | continue
|
| | |
|
| | | mailState = mailObj.GetMailState()
|
| | | mailItemCount = mailMgr.GetMailItemCount(guid)
|
| | | if mailItemCount and mailState != ShareDefine.MailState_Got:
|
| | | #GameWorld.DebugLog("个人邮件有物品未领取不删除! %s" % guid, playerID)
|
| | | continue
|
| | | #mailState = mailObj.GetMailState()
|
| | | #mailItemCount = mailMgr.GetMailItemCount(guid)
|
| | | #if mailItemCount and mailState != ShareDefine.MailState_Got:
|
| | | # #GameWorld.DebugLog("个人邮件有物品未领取不删除! %s" % guid, playerID)
|
| | | # continue
|
| | |
|
| | | mailMgr.DelPersonalMail(playerID, guid)
|
| | | DataRecordPack.DR_MailDel(playerID, guid, "Timeout")
|
| | |
| | |
|
| | | def SendMailByKey(mailTypeKey, playerID, itemList, paramList=[], limitDays=7):
|
| | | ## 发送个人邮件魔板
|
| | | # @param itemList: 元素支持字典{itemID:itemCount, ...} 或列表 [itemID, itemCount, 可选是否拍品, 物品UserData]
|
| | | if not mailTypeKey:
|
| | | mailTypeKey = ShareDefine.DefaultLackSpaceMailType
|
| | | title = "<T>%s</T>" % mailTypeKey
|
| | | text = "%s" % json.dumps(paramList, ensure_ascii=False)
|
| | | text = "%s" % json.dumps([str(p) for p in paramList], ensure_ascii=False) #参数全部转为字符串
|
| | | SendMail(playerID, title, text, itemList, limitDays)
|
| | | return
|
| | |
|
| | | def SendMail(playerID, title, text, itemList=None, limitDays=7, mailType=0):
|
| | | ## 发送个人邮件
|
| | | # @param itemList: 元素支持字典{itemID:itemCount, ...} 或列表 [itemID, itemCount, 可选是否拍品, 物品UserData]
|
| | | if itemList == None:
|
| | | itemList = []
|
| | | |
| | | if isinstance(itemList, dict):
|
| | | itemList = [[itemID, itemCount] for itemID, itemCount in itemList.items()]
|
| | | mailMgr = DBDataMgr.GetMailMgr()
|
| | | mailMax = IpyGameDataPY.GetFuncCfg("PersonalMail", 1)
|
| | | mailCnt = mailMgr.GetPersonalMailCount(playerID)
|
| | |
| | | def SendSeverMail(guid, title, text, itemList=None, limitDays=7, mailType=0, limitLV=0, limitLVType=0, checkState=0):
|
| | | '''发送全服邮件
|
| | | @param guid: 可传入空,则系统自动生成guid
|
| | | @param itemList: 元素支持字典{itemID:itemCount, ...} 或列表 [itemID, itemCount, 可选是否拍品, 物品UserData]
|
| | | @param limitLV: 限制可领的最低等级
|
| | | @param limitLVType: 等级达到后是否可领,默认不可
|
| | | @param checkState: 是否需要审核,默认不需要
|
| | | @return: None - 发送失败; mailObj - 成功发送的邮件实例
|
| | | '''
|
| | | if itemList == None:
|
| | | itemList = []
|
| | | if isinstance(itemList, dict):
|
| | | itemList = [[itemID, itemCount] for itemID, itemCount in itemList.items()]
|
| | | mailMgr = DBDataMgr.GetMailMgr()
|
| | | mailObj = mailMgr.AddServerMail(guid, title, text, itemList, limitDays, mailType)
|
| | | if not mailObj:
|
| | |
| | | itemCount = mailItem.GetCount()
|
| | | isBind = mailItem.GetIsBind()
|
| | | userData = mailItem.GetUserData()
|
| | | #setAttrDict = {} if not userData else eval(userData) 之后扩展有指定属性的,可参考砍树版本
|
| | | setAttrDict = None
|
| | | if userData:
|
| | | try:
|
| | | setAttrDict = eval(userData)
|
| | | except:
|
| | | setAttrDict = None
|
| | | if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem],
|
| | | event=[ChConfig.ItemGive_Mail, False, {"MailGUID":guid}]):
|
| | | event=[ChConfig.ItemGive_Mail, False, {"MailGUID":guid}], setAttrDict=setAttrDict):
|
| | | continue
|
| | |
|
| | | DataRecordPack.DR_MailGiveSuccess(playerID, guid)
|