|  |  | 
 |  |  | import GameWorld
 | 
 |  |  | import PlayerControl
 | 
 |  |  | import NetPackCommon
 | 
 |  |  | import GameWorldArena
 | 
 |  |  | import ChPyNetSendPack
 | 
 |  |  | import PlayerFBHelpBattle
 | 
 |  |  | import PyGameDataStruct
 | 
 |  |  | 
 |  |  | import ChConfig
 | 
 |  |  | 
 | 
 |  |  | import json
 | 
 |  |  | import time
 | 
 |  |  | 
 | 
 |  |  | def DoOnDayEx():
 | 
 |  |  |     DelOutofTimeViewCacheData()
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def IsSaveDBViewCache(playerID, playerLV):
 | 
 |  |  |     ## 是否保存基本的缓存数据
 | 
 |  |  |     if PlayerFBHelpBattle.IsInHelpBattleCheckInList(playerID):
 | 
 |  |  |         return True
 | 
 |  |  |      | 
 |  |  |     if GameWorldArena.IsArenaBattlePlayer(playerID):
 | 
 |  |  |         return True
 | 
 |  |  |     
 | 
 |  |  |     SaveDBLimitLV = IpyGameDataPY.GetFuncCfg("PlayerViewCache", 1)
 | 
 |  |  | 
 |  |  | 
 | 
 |  |  | def IsSaveAllViewCache(playerID):
 | 
 |  |  |     ## 是否保存所有缓存数据
 | 
 |  |  |      | 
 |  |  |     if PlayerFBHelpBattle.IsInHelpBattleCheckInList(playerID):
 | 
 |  |  |         return True
 | 
 |  |  |      | 
 |  |  |     if GameWorldArena.IsArenaBattlePlayer(playerID):
 | 
 |  |  |         return True
 | 
 |  |  |     
 | 
 |  |  |     NeedCheckBillBoardType = IpyGameDataPY.GetFuncEvalCfg("PlayerViewCache", 2)
 | 
 |  |  |     #校验玩家是否上排行榜
 | 
 |  |  | 
 |  |  |         
 | 
 |  |  |     return False
 | 
 |  |  | 
 | 
 |  |  | def DelOutofTimeViewCacheData():
 | 
 |  |  |     ## 删除过期的查看缓存数据
 | 
 |  |  |      | 
 |  |  |     curTime = int(time.time())
 | 
 |  |  |     MaxTime = 30 * 3600 * 24 # 30天
 | 
 |  |  |      | 
 |  |  |     pyViewCacheMgr = PyDataManager.GetPlayerViewCachePyManager()
 | 
 |  |  |     playerViewCachePyDict = pyViewCacheMgr.playerViewCachePyDict
 | 
 |  |  |     for playerID, viewCache in playerViewCachePyDict.items():
 | 
 |  |  |          | 
 |  |  |         passTime = curTime - viewCache.OffTime
 | 
 |  |  |         if passTime < MaxTime:
 | 
 |  |  |             continue
 | 
 |  |  |         if IsSaveAllViewCache(playerID):
 | 
 |  |  |             continue
 | 
 |  |  |         playerViewCachePyDict.pop(playerID)
 | 
 |  |  |          | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def DeleteViewCache(playerID):
 | 
 |  |  |     ## 删除玩家缓存
 | 
 |  |  |     pyViewCacheMgr = PyDataManager.GetPlayerViewCachePyManager()
 | 
 |  |  |     playerViewCachePyDict = pyViewCacheMgr.playerViewCachePyDict
 | 
 |  |  |     playerViewCachePyDict.pop(playerID)
 | 
 |  |  |     playerViewCachePyDict.pop(playerID, None)
 | 
 |  |  |     GameWorld.DebugLog("删除查看缓存!", playerID)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | 
 |  |  |             answerPack.LV = cacheDict["LV"]
 | 
 |  |  |             answerPack.RealmLV = cacheDict["RealmLV"]
 | 
 |  |  |             answerPack.OnlineType = ChConfig.Def_Offline
 | 
 |  |  |             answerPack.ServerGroupID = cacheDict.get("ServerGroupID", 0)
 | 
 |  |  |              | 
 |  |  |             if GameWorld.IsCrossServer():
 | 
 |  |  |                 answerPack.ServerGroupID = cacheDict.get("ServerGroupID", 0)
 | 
 |  |  |             else:
 | 
 |  |  |                 answerPack.ServerGroupID = GameWorld.GetServerGroupID()
 | 
 |  |  |     else:
 | 
 |  |  |         answerPack.PlayerID = clientPack.PlayerID
 | 
 |  |  |         answerPack.PlayerName = tagPlayer.GetName()
 |