ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
@@ -115,6 +115,7 @@
        self.__clientServerDataVer = 0 # 子服榜单数据版本
        self.__billboardList = [] # [tagDBCrossBillboard, ...] 
        self.__idOrderDict = {} # {id:名次, ...}
        self.__sortDelay = False # 是否需要延迟排序
        return
    
    def GetBillboardType(self): return self.__billboardType
@@ -133,9 +134,27 @@
        return
    
    def SortData(self):
        GameWorld.DebugLog("跨服榜单排序: billboardType=%s,groupValue1=%s,groupValue2=%s,dataCount=%s"
                      % (self.__billboardType, self.__groupValue1, self.__groupValue2, len(self.__billboardList)))
        self.__billboardList.sort(key=operator.attrgetter("CmpValue", "CmpValue2", "CmpValue3"), reverse=True)
        self.__idOrderDict = {} # 排序后重置,下次查询时更新并缓存
        self.__sortDelay = False
        self.UpdCrossServerDataVer()
        return
    def SetDelaySort(self):
        ## 设置延迟排序
        GameWorld.DebugLog("跨服榜单设置延迟排序: billboardType=%s,groupValue1=%s,groupValue2=%s,dataCount=%s"
                      % (self.__billboardType, self.__groupValue1, self.__groupValue2, len(self.__billboardList)))
        self.__sortDelay = True
        self.UpdCrossServerDataVer()
        return
    def DoDelaySort(self):
        ## 延迟排序
        if not self.__sortDelay:
            return
        self.SortData()
        return
    
    def AddBillboardData(self, billboardData):
@@ -172,6 +191,7 @@
    def SaveDRData(self, eventName="", addDataDict={}):
        ## 记录流向数据
        
        self.DoDelaySort()
        dataCount = len(self.__billboardList)
        if not dataCount:
            return
@@ -288,6 +308,15 @@
        for billboardType, groupValue1, groupValue2 in groupList:
            billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2)
            billboardObj.SaveDRData("OnDay")
    return
def OnMinuteProcess():
    billboardMgr = PyDataManager.GetCrossBillboardManager()
    for billboardType in ShareDefine.CrossBillboardTypeList:
        groupList = billboardMgr.GetBillboardGroupList(billboardType)
        for billboardType, groupValue1, groupValue2 in groupList:
            billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2)
            billboardObj.DoDelaySort()
    return
def CopyBillboard(fromBillboardType, toBillboardType):
@@ -419,6 +448,7 @@
        queryData = {}
    billboardMgr = PyDataManager.GetCrossBillboardManager()
    billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2)
    billboardObj.DoDelaySort()
    crossServerDataVer = billboardObj.GetCrossServerDataVer()
    msgData = {"BillboardType":billboardType, "GroupValue1":groupValue1, "GroupValue2":groupValue2,
               "QueryData":queryData, "CrossServerDataVer":crossServerDataVer}
@@ -757,8 +787,15 @@
                          type2, value1, value2, cmpValue, cmpValue2, cmpValue3, kwargs), dataID)
    if noSortAndSync:
        return True
    if autoSort and cmpValueChange:
    # 新数据可能导致榜单ID增减,强制排序一次
    if isNewData:
        billboardObj.SortData()
    elif cmpValueChange:
        if autoSort:
            billboardObj.SortData()
        else:
            billboardObj.SetDelaySort()
    else:
        billboardObj.UpdCrossServerDataVer()
    return True