From 2b1f9e7dcc20440576ee63014e0080a529ab0486 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 14 一月 2021 18:31:22 +0800
Subject: [PATCH] 4908 【BT】【主干】gameserver realtime备份过大导致卡顿(优化拍品记录保存期限;输出自定义表存档大小);

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py |   50 ++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py
index 069343f..ab5bef3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py
@@ -29,6 +29,9 @@
 import EventReport
 import ChConfig
 import PlayerControl
+import IpyGameDataPY
+
+import time
 
 ##A5 3B 请求领取补偿#tagCMRequestCompensation
 #  @param index, clientPack, tick
@@ -68,6 +71,7 @@
         GameWorld.DebugLog("    PlayerID %s no found "%curPackData.PlayerID)
         return
     
+    hasAuctionItem = False
     needPackSpaceDict = {}
     isPackSpaceEnough = True
     # 先汇总物品所属背包
@@ -78,16 +82,42 @@
         if not curItemData:
             continue
         
+        isAuctionItem = curPackItem.IsBind
         packType = ChConfig.GetItemPackType(curItemData.GetType())
-        needSpace = ItemControler.GetItemNeedPackCount(packType, curItemData, curPackItem.Count)
+        needSpace = ItemControler.GetItemNeedPackCount(packType, curItemData, curPackItem.Count, isAuctionItem)
         needPackSpaceDict[packType] = needPackSpaceDict.get(packType, 0) + needSpace
+        if isAuctionItem:
+            hasAuctionItem = True
             
-    GameWorld.DebugLog("    needPackSpaceDict=%s" % str(needPackSpaceDict))
+    GameWorld.DebugLog("    hasAuctionItem=%s,needPackSpaceDict=%s" % (hasAuctionItem, needPackSpaceDict))
     for packType, needSpace in needPackSpaceDict.items():
         if needSpace > ItemCommon.GetItemPackSpace(curPlayer, packType, needSpace):
             PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [packType])
             isPackSpaceEnough = False
             break
+        
+    auctionItemTimeout = False
+    auctionItemCreateTime = 0
+    # 20201223 主干取消拍品有效时长设定
+#    if hasAuctionItem:
+#        auctionItemValidTimesMax = IpyGameDataPY.GetFuncCfg("AuctionItem", 1) * 3600 # 拍品有效时长
+#        auctionItemValidTimesMail = IpyGameDataPY.GetFuncCfg("AuctionItem", 2) * 3600 # 邮件拍品附加有效时长
+#        auctionItemValidTimesTotal = auctionItemValidTimesMail + auctionItemValidTimesMax
+#        mailCreateTimeStr = curPackData.CreateTime
+#        mailCreateTime = GameWorld.ChangeTimeStrToNum(mailCreateTimeStr)
+#        curTime = int(time.time())
+#        passTime = curTime - mailCreateTime
+#        if passTime <= auctionItemValidTimesMail:
+#            GameWorld.DebugLog("邮件拍品领取时间在附加保护时长内,拍品创建时间即领取邮件时间开始算!passTime(%s) <= auctionItemValidTimesMail(%s)" % (passTime, auctionItemValidTimesMail))
+#            pass
+#        elif auctionItemValidTimesMail < passTime < auctionItemValidTimesTotal:
+#            auctionItemCreateTime = curTime - (passTime - auctionItemValidTimesMail)
+#            GameWorld.DebugLog("邮件拍品领取时间超过邮件保护时间,拍品创建时间需扣除领取时的溢出时间!auctionItemValidTimesMail(%s) < passTime(%s) < auctionItemValidTimesTotal(%s), auctionItemCreateTime=%s" 
+#                               % (auctionItemValidTimesMail, passTime, auctionItemValidTimesTotal, GameWorld.ChangeTimeNumToStr(auctionItemCreateTime)))
+#        elif passTime >= auctionItemValidTimesMax:
+#            auctionItemTimeout = True
+#            GameWorld.DebugLog("邮件中的拍品已过期,将自动转为非拍品!passTime(%s) >= auctionItemValidTimesMax(%s)" 
+#                               % (passTime, auctionItemValidTimesMax))
             
     #背包空间不足
     if not isPackSpaceEnough:
@@ -108,23 +138,27 @@
     for i in xrange(curPackData.Count):
         curPackItem = curPackData.Items[i]
         itemID = curPackItem.ItemID
+        isAuctionItem = curPackItem.IsBind and not auctionItemTimeout
         if ItemControler.GetAppointItemRealID(itemID):
-            #定制物品
-            ItemControler.GivePlayerItem(curPlayer, itemID, curPackItem.Count, curPackItem.IsBind, [IPY_GameWorld.rptItem], 
-                                         False, showSysInfo=False, event=[ChConfig.ItemGive_Mail, False, {"MailGUID":curPackData.GUID}])
-            continue
-        
-        curCreateItem = ItemCommon.CreateSingleItem(itemID, curPackItem.Count, not curPackItem.IsBind)
+            curCreateItem = ItemControler.GetItemByData(ItemControler.GetAppointItemDictData(itemID, isAuctionItem))
+        else:
+            curCreateItem = ItemCommon.CreateSingleItem(itemID, curPackItem.Count, isAuctionItem)
         if not curCreateItem:
             GameWorld.ErrLog("OnGMRequestCompensationResult CreateSingleItem %s Err "%itemID)
             continue
         
         ##UserData包含了追加属性不完整,这里需要补齐
+        userDataCreateTime = 0
         if curPackItem.UserDataLen: 
             UserDataDict = eval(curPackItem.UserData)
             #设置UserData
             UserData = "%s"%UserDataDict
             curCreateItem.SetUserData(UserData, len(UserData))
+            userDataCreateTime = curCreateItem.GetUserAttr(ShareDefine.Def_IudetAuctionItemCreateTime)
+            
+        if isAuctionItem and auctionItemCreateTime and not userDataCreateTime:
+            curCreateItem.SetUserAttr(ShareDefine.Def_IudetAuctionItemCreateTime, auctionItemCreateTime)
+            
         ItemCommon.MakeEquipGS(curCreateItem)
         #放入玩家背包
         ItemControler.PlayerItemControler(curPlayer).PutInItem(IPY_GameWorld.rptItem, curCreateItem, 

--
Gitblit v1.8.0