hxp
2019-12-10 ed70a10c9930216ebc72713e37e21cb1d33349e2
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
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package GMT_GetPlayerForbid.py
# ²éѯȫ·þ´¦·£ÐÅÏ¢
#
# @author whx
# @date 2012-08-10 17:00
# @version 1.0
#
# @note
#---------------------------------------------------------------------
"""Version = 2012-08-10 17:00"""
#---------------------------------------------------------------------
#µ¼Èë
from MangoDBCommon import fix_incomingText
from Collections.CollectionDefine import *
from Common import (CommFuncEx, mylog)
from Collections import DataServerPlayerData
import GMCommon
#---------------------------------------------------------------------
#È«¾Ö±äÁ¿
 
#---------------------------------------------------------------------
 
## ÊÕµ½gmÃüÁîÖ´ÐÐ
# @param gmCmdDict:gmÃüÁî×Öµä
# @return None 
def OnExec(gmCmdDict):
    queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
    
    #Íæ¼Ò´¦·ÖÃûµ¥
    if queryType == "allPlayer":
        return GMCommon.Def_DoQueryUserDB, ""
    
    #IP´¦·ÖÐÅÏ¢
    elif queryType == "allIP":
        return GMCommon.Def_SendToGameServer, ""
    
    # »Ø¸´
    return GMCommon.Def_ParamErr, ''
    
    
## ²éѯlogdb·µ»Ø
# @param logdb:logdb
# @param data:´«ÈëµÄÐÅÏ¢
# @param gmCmdDict:gmÃüÁî×Öµä
# @return None 
def LogDBResponse(logdb, data, gmCmdDict):
    queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
    
    #Íæ¼Ò´¦·ÖÃûµ¥
    if queryType == "allPlayer":
        return GMCommon.Def_DoQueryUserDB, ""
    
    #IP´¦·ÖÐÅÏ¢
    elif queryType == "allIP":
        return GMCommon.Def_SendToGameServer, ""
    
    # »Ø¸´
    return GMCommon.Def_ParamErr, ''
 
 
## ²éѯuserdb·µ»Ø
# @param userdb:userdb
# @param data:´«ÈëµÄÐÅÏ¢
# @param gmCmdDict:gmÃüÁî×Öµä
# @return None 
def UserDBResponse(userdb, data, gmCmdDict):
    queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
    
    #IP´¦·ÖÐÅÏ¢
    if queryType == "allIP":
        return GMCommon.Def_SendToGameServer, ""
    
    forbidLoginList = []
    forbidTalkList = []
    
    collection = userdb[UCN_DBPlayer]
    allPlayer = collection.find() 
    
    playerCnt = allPlayer.count()
    
    if playerCnt <= 0:
        return GMCommon.Def_NoTag, ''
    
    for i in range(playerCnt):
        player = allPlayer[i]
        
        accState = player.get('AccState', 0)
        
        #Ëø¶¨
        if (accState & pow(2, GMCommon.Def_PysForbidByPy)) > 0:
            accID = player.get('AccID', "")
            forbidLoginList.append(accID)
        
        if (accState & pow(2, GMCommon.Def_PysForbidTalk)) > 0:
            accID = player.get('AccID', "")
            forbidTalkList.append(accID)
    
    forbidInfo = {
              'forbidLoginList':forbidLoginList,  #ÊÇ·ñËø¶¨
              'forbidTalkList':forbidTalkList,  #ÊÇ·ñ½ûÑÔ
              }
    
    return GMCommon.Def_Success, forbidInfo