| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #---------------------------------------------------------------------
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | #---------------------------------------------------------------------
|
| | | ##@package GMT_UnForbidLogin.py
|
| | | # GM命令解锁玩家账号
|
| | | ##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_ForbidLogin
|
| | | #
|
| | | # @author wdb
|
| | | # @date 2012-6-14
|
| | | # @version 1.2
|
| | | # @todo:GM工具命令 - 封号/解封
|
| | | # @author hxp
|
| | | # @date 2026-03-06
|
| | | # @version 1.0
|
| | | #
|
| | | # @note
|
| | | # @change: "2012-06-21 15:30" wdb int修改到GMCommon开接口
|
| | | # @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
|
| | | # 详细描述: GM工具命令 - 封号/解封
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2026-03-06 15:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GMCommon
|
| | | #---------------------------------------------------------------------
|
| | | #全局变量
|
| | | from Player import (PlayerControl)
|
| | | from Collections.CollectionDefine import *
|
| | | import IPY_GameWorld
|
| | | import DataRecordPack
|
| | | import PyGameData
|
| | | import ChConfig
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | ## 收到gm命令执行
|
| | | # @param gmCmdDict:gm命令字典
|
| | | # @return None |
| | | def OnExec(gmCmdDict):
|
| | | playerAccID = gmCmdDict.get(GMCommon.Def_GMKey_PlayerAccID, '')
|
| | | playerName = gmCmdDict.get(GMCommon.Def_GMKey_PlayerName, '')
|
| | | queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
|
| | | #playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')
|
| | | if queryType == "IP":
|
| | | return __doForbidLoginByIP(gmCmdDict)
|
| | |
|
| | | if playerAccID != '':
|
| | | return GMCommon.Def_DoQueryLogDB, ''
|
| | | |
| | | elif playerName != '': |
| | | return GMCommon.Def_DoQueryUserDB, '%s'%GMCommon.Def_GMKey_PlayerName
|
| | | # 回复
|
| | | return GMCommon.Def_ParamErr, ''
|
| | | forbidType = gmCmdDict.get("forbidType", '')
|
| | |
|
| | | errorMsg = "" |
| | | from GMToolLogicProcess import ProjSpecialProcess
|
| | | Result, curPlayer = ProjSpecialProcess.GMCmdPlayerValidation(gmCmdDict, False) # 不支持离线处理
|
| | | if Result == GMCommon.Def_PlayerOfLine:
|
| | | dbPlayer = curPlayer
|
| | | return __doForbidLoginByDBPlayer(dbPlayer, forbidType)
|
| | |
|
| | | ## 查询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, ''
|
| | | |
| | | # 转换字符串
|
| | | if data != '' and GMCommon.GetPlayerOnLineByAccID(logdb, data): |
| | | return GMCommon.Def_SendToGameServer, ''
|
| | | if Result != GMCommon.Def_Success:
|
| | | return Result, errorMsg
|
| | |
|
| | | 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 forbidType == "1":
|
| | | # 玩家在线,可处理
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | Result = GMCommon.Def_Unknow
|
| | | #GMT_Name = gmCmdDict.get(GMCommon.Def_GMKey_Type, '') |
| | |
|
| | | if playerAccID == '':
|
| | | return GMCommon.Def_NoTag, ''
|
| | | PlayerControl.SetPlayerAccState(curPlayer, curPlayer.GetAccState() | pow(2, ChConfig.Def_PysForbidByPy))
|
| | | DataRecordPack.DR_ToolGMOperate(playerID, curPlayer.GetPlayerName(), curPlayer.GetAccID(), "GMTFobidLogin")
|
| | | curPlayer.Kick(IPY_GameWorld.disGMKick)
|
| | | |
| | | else:
|
| | | return GMCommon.Def_NoNeed, "玩家正常在线"
|
| | |
|
| | | # 返回playerid,判断是否在线
|
| | | if data == '%s'%GMCommon.Def_GMKey_PlayerName: |
| | | return GMCommon.Def_DoQueryLogDB, playerAccID
|
| | | return GMCommon.Def_Success
|
| | |
|
| | | def __doForbidLoginByDBPlayer(dbPlayer, forbidType):
|
| | | ## 离线根据dbPlayer处理
|
| | |
|
| | | collection = userdb[UCN_DBPlayer]
|
| | | dbPlayer = DataServerPlayerData.tagDBPlayer()
|
| | | dbPlayer.IsDeleted = 0
|
| | | col = PyGameData.g_usrCtrlDB.db[UCN_DBPlayer]
|
| | |
|
| | | loadOK = dbPlayer.adoLoadCEx(collection, {'AccID':fix_incomingText(playerAccID),
|
| | | 'IsDeleted':dbPlayer.IsDeleted}) |
| | | if not loadOK:
|
| | | # 回复gm
|
| | | return GMCommon.Def_NoTag, ''
|
| | | playerID = dbPlayer.PlayerID
|
| | | playerName = dbPlayer.PlayerName
|
| | | accID = dbPlayer.AccID
|
| | |
|
| | | # 已是锁定状态
|
| | | if (dbPlayer.AccState & pow(2, GMCommon.Def_PysForbidByPy)) > 0:
|
| | | return GMCommon.Def_NoNeed, ''
|
| | | |
| | | # 设置玩家账号状态
|
| | | dbPlayer.AccState = dbPlayer.AccState|pow(2, GMCommon.Def_PysForbidByPy)
|
| | | dbPlayer.ExAttr17 = dbPlayer.AccState
|
| | | dbPlayer.adoUpdateC(collection)
|
| | | |
| | | if forbidType == "1":
|
| | | if (dbPlayer.AccState & pow(2, GMCommon.Def_PysForbidByPy)) > 0:
|
| | | return GMCommon.Def_NoNeed, "已经被封号了"
|
| | | |
| | | # 设置玩家账号状态
|
| | | dbPlayer.AccState = dbPlayer.AccState | pow(2, GMCommon.Def_PysForbidByPy)
|
| | | dbPlayer.ExAttr17 = dbPlayer.AccState
|
| | | dbPlayer.adoUpdateC(col)
|
| | | |
| | | gmToolCmd = "GMTFobidLogin"
|
| | | else:
|
| | | if (dbPlayer.AccState & pow(2, GMCommon.Def_PysForbidByPy)) <= 0:
|
| | | return GMCommon.Def_NoNeed, "玩家账号正常"
|
| | | |
| | | # 设置玩家账号状态
|
| | | dbPlayer.AccState = dbPlayer.AccState ^ pow(2, GMCommon.Def_PysForbidByPy)
|
| | | dbPlayer.ExAttr17 = dbPlayer.AccState
|
| | | dbPlayer.adoUpdateC(col)
|
| | | |
| | | gmToolCmd = "GMTFobidLogin"
|
| | | |
| | | # 记录流向
|
| | | dataDic = {"PlayerID":dbPlayer.PlayerID, 'AccID':playerAccID}
|
| | | GMCommon.SendEventPack(gmCmdDict.get(GMCommon.Def_GMKey_Type, ''), dataDic)
|
| | | return GMCommon.Def_Success, ''
|
| | | DataRecordPack.DR_ToolGMOperate(playerID, playerName, accID, gmToolCmd)
|
| | | return GMCommon.Def_Success
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | def __doForbidLoginByIP(gmCmdDict):
|
| | | Result = GMCommon.Def_Unknow
|
| | | # 暂不支持,后续扩展,需要处理全局管理
|
| | | return Result, "暂不支持"
|