hxp
2025-02-06 a90833bf05d8f4a338b0224a956a3794c106bb48
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GM.Commands.GMT_QueryBillboardCross
#
# @todo:²éѯ¿ç·þÅÅÐаñ
# @author hxp
# @date 2021-01-13
# @version 1.0
#
# ÏêϸÃèÊö: ²éѯ¿ç·þÅÅÐаñ
#
#-------------------------------------------------------------------------------
#"""Version = 2021-01-13 17:00"""
#-------------------------------------------------------------------------------
 
#µ¼Èë
import GMCommon
import ShareDefine
import PyDataManager
import GameWorld
 
 
#Âß¼­ÊµÏÖ(ÕâÀïcurPlayer = None)
## Ö´ÐÐÂß¼­
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param gmList [cmdIndex gmAccID forbidAcc]
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(orderId, gmCmdDict):
    
    if not GameWorld.IsCrossServer():
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_IsNotCrossServer)
        return
    
    billboardType = GameWorld.ToIntDef(gmCmdDict.get('billboardType', ''), None)
    billType = GameWorld.ToIntDef(gmCmdDict.get('billType', ''), None) # ÆäËûÖ¸¶¨ÀàÐÍ
    if billType != None:
        billboardType = billType
        
    if billboardType == None or billboardType not in ShareDefine.CrossBillboardTypeList:
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_TypeNumErr)
        return
    
    groupValue1 = GameWorld.ToIntDef(gmCmdDict.get('groupValue1', ''), None)
    groupValue2 = GameWorld.ToIntDef(gmCmdDict.get('groupValue2', ''), None)
    queryCount = GameWorld.ToIntDef(gmCmdDict.get('queryCount', ''), 10)
    startRank = GameWorld.ToIntDef(gmCmdDict.get('startRank', ''), 1)
    startRank = max(1, startRank)
    
    billboardMgr = PyDataManager.GetCrossBillboardManager()
    groupList = billboardMgr.GetBillboardGroupList(billboardType)
    dataTotalDict = {}
    for bType, gValue1, gValue2 in groupList:
        billboardObj = billboardMgr.GetCrossBillboard(bType, gValue1, gValue2)
        dataTotalDict["%s-%s-%s" % (bType, gValue1, gValue2)] = billboardObj.GetCount()
        
    backMsg = {"billboardType":billboardType, "groupList":groupList, "dataTotalDict":dataTotalDict, 
               "groupValue1":groupValue1, "groupValue2":groupValue2, "queryCount":queryCount, "startRank":startRank}
    
    if groupValue1 != None and groupValue2 != None:
        billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2)
        billboardObj.DoDelaySort()
        idOrderDict = billboardObj.GetIDOrderDict()
        
        dataTotal = billboardObj.GetCount()
        fromIndex = startRank - 1
        toIndex = fromIndex + queryCount
        billboardInfo = []
        for i in xrange(startRank - 1, toIndex):
            if i >= dataTotal:
                break
            billboardData = billboardObj.At(i)
            if not billboardData:
                continue
            rank = idOrderDict.get(billboardData.ID, i + 1)
            billboardDict = {
                             "Index":i,
                             "Rank":rank,
                             "ID":billboardData.ID,
                             "ID2":billboardData.ID2,
                             "Name1":billboardData.Name1,
                             "Name2":billboardData.Name2,
                             "Type2":billboardData.Type2,
                             "Value1":billboardData.Value1,
                             "Value2":billboardData.Value2,
                             "Value3":billboardData.Value3,
                             "Value4":billboardData.Value4,
                             "Value5":billboardData.Value5,
                             "Value6":billboardData.Value6,
                             "Value7":billboardData.Value7,
                             "Value8":billboardData.Value8,
                             "CmpValue":billboardData.CmpValue,
                             "CmpValue2":billboardData.CmpValue2,
                             "CmpValue3":billboardData.CmpValue3,
                             "UserData":billboardData.UserData,
                             }
            
            # 20210120 ºǫ́û×öÇø·Ö²»Í¬°æ±¾£¬ÔÝʱÓÃÓÎÏ·°æ±¾´úÂë×ö·µ»ØÖµÇø·Ö£»£¨BT°æ´æµÄÊÇÔª£¬Ö÷¸É¸Ų̂°æ´æµÄÊÇ·Ö£¬ÃÀÔªÖ§³Öµ½·Ö£©
            if billboardType in [ShareDefine.Def_CBT_ActCTG]:
                billboardDict["CmpValue"] = billboardData.CmpValue / 100.0
                
            for k, v in billboardDict.items():
                if not v:
                    billboardDict.pop(k)
                    
            billboardInfo.append(billboardDict)
            
        backMsg.update({"billboardInfo":billboardInfo, "groupValue1":groupValue1, "groupValue2":groupValue2, "dataTotal":dataTotal})
        
    #Ö´Ðгɹ¦
    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, backMsg)
    return