#!/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  
 | 
      
 | 
      
 |