|  |  |  | 
|---|
|  |  |  | import ChConfig | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import json | 
|---|
|  |  |  | import time | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def DoOnDayEx(): | 
|---|
|  |  |  | DelOutofTimeViewCacheData() | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def IsSaveDBViewCache(playerID, playerLV): | 
|---|
|  |  |  | ## 是否保存基本的缓存数据 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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() | 
|---|