#!/usr/bin/python # -*- coding: GBK -*- #--------------------------------------------------------------------- # #--------------------------------------------------------------------- ##@package GMT_ForbidTalk.py # GMÃüÁîÍæ¼Ò½ûÑÔ # # @author wdb # @date 2012-6-14 # @version 1.1 # # @note # @change: "2012-07-12 18:00" wdb Ôö¼Ó±àÂëÊôÐÔ #--------------------------------------------------------------------- """Version = 2012-07-12 18: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): loginIP = gmCmdDict.get(GMCommon.Def_GMKey_IP, '') playerAccID = gmCmdDict.get(GMCommon.Def_GMKey_PlayerAccID, '') playerName = gmCmdDict.get(GMCommon.Def_GMKey_PlayerName, '') if playerAccID != '': return GMCommon.Def_DoQueryLogDB, '' elif loginIP != '': return GMCommon.Def_SendToGameServer, '' elif playerName != '': return GMCommon.Def_DoQueryUserDB, '%s'%GMCommon.Def_GMKey_PlayerName # »Ø¸´ return GMCommon.Def_ParamErr, '' ## ²éѯlogdb·µ»Ø # @param logdb:logdb # @param data:´«ÈëµÄÐÅÏ¢ # @param gmCmdDict:gmÃüÁî×Öµä # @return None def LogDBResponse(logdb, data, gmCmdDict): playerAccID = gmCmdDict.get(GMCommon.Def_GMKey_PlayerAccID, '') # Íæ¼ÒÔÚÏß if playerAccID != '' and GMCommon.GetPlayerOnLineByAccID(logdb, playerAccID): return GMCommon.Def_SendToGameServer, '' # accid²éѯ if data != '' and GMCommon.GetPlayerOnLineByAccID(logdb, data): return GMCommon.Def_SendToGameServer, '' return GMCommon.Def_DoQueryUserDB, '' ## ²éѯuserdb·µ»Ø # @param userdb:userdb # @param data:´«ÈëµÄÐÅÏ¢ # @param gmCmdDict:gmÃüÁî×Öµä # @return None def UserDBResponse(userdb, data, gmCmdDict): playerAccID = gmCmdDict.get(GMCommon.Def_GMKey_PlayerAccID, '') playerName = gmCmdDict.get(GMCommon.Def_GMKey_PlayerName, '') # È¡µÃÍæ¼Òaccid if playerName != '': playerAccID = GMCommon.GetPlayerAccID(userdb, {'PlayerName':fix_incomingText(playerName), 'IsDeleted':0}) if playerAccID == '': return GMCommon.Def_NoTag, '' # ·µ»Øplayerid£¬ÅжÏÊÇ·ñÔÚÏß if data == '%s'%GMCommon.Def_GMKey_PlayerName: return GMCommon.Def_DoQueryLogDB, playerAccID collection = userdb[UCN_DBPlayer] dbPlayer = DataServerPlayerData.tagDBPlayer() dbPlayer.IsDeleted = 0 loadOK = dbPlayer.adoLoadCEx(collection, {'AccID':fix_incomingText(playerAccID), 'IsDeleted':dbPlayer.IsDeleted}) if not loadOK: return GMCommon.Def_NoTag, '' forbidDevice = gmCmdDict.get("forbidDevice", '') forbidType = GMCommon.Def_PysForbidTalkDevice if forbidDevice else GMCommon.Def_PysForbidTalk # Íæ¼ÒÕ˺ÅÒѽû if (dbPlayer.AccState & pow(2, forbidType)) > 0: return GMCommon.Def_NoNeed, '' # ÉèÖÃÍæ¼ÒÕ˺Å״̬ dbPlayer.AccState = dbPlayer.AccState|pow(2, forbidType) if forbidType == GMCommon.Def_PysForbidTalkDevice: dbPlayer.AccState = dbPlayer.AccState|pow(2, GMCommon.Def_PysForbidTalk) dbPlayer.ExAttr17 = dbPlayer.AccState dbPlayer.adoUpdateC(collection) # ¼Ç¼Á÷Ïò dataDic = {"PlayerID":dbPlayer.PlayerID, 'AccID':playerAccID} GMCommon.SendEventPack(gmCmdDict.get(GMCommon.Def_GMKey_Type, ''), dataDic) mylog.info("GMT_ForbidTalk: playerAccID=%s,forbidType=%s,AccState=%s" % (playerAccID, forbidType, dbPlayer.AccState)) return GMCommon.Def_Success, ''