From e4a73fcd808bcf5e22099b73f2bc98e8b6ee84c6 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 06 三月 2026 14:56:17 +0800
Subject: [PATCH] 16 卡牌服务端(后台禁言、封号支持;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/Commands/GMT_ForbidTalk.py |  178 ++++++++++++++++++++++++++---------------------------------
 1 files changed, 78 insertions(+), 100 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/Commands/GMT_ForbidTalk.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/Commands/GMT_ForbidTalk.py
index 4a16f71..8c79a0a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/Commands/GMT_ForbidTalk.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/Commands/GMT_ForbidTalk.py
@@ -1,117 +1,95 @@
 #!/usr/bin/python
 # -*- coding: GBK -*-
-#---------------------------------------------------------------------
+#-------------------------------------------------------------------------------
 #
-#---------------------------------------------------------------------
-##@package GMT_ForbidTalk.py
-# GM命令玩家禁言
+##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_ForbidTalk
 #
-# @author wdb
-# @date 2012-6-14
-# @version 1.1
+# @todo:GM工具命令 - 禁言/解禁
+# @author hxp
+# @date 2026-03-06
+# @version 1.0
 #
-# @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
+# 详细描述: GM工具命令 - 禁言/解禁
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2026-03-06 15:00"""
+#-------------------------------------------------------------------------------
+
 import GMCommon
-#---------------------------------------------------------------------
-#全局变量
+import GameWorld
+from Player import (PlayerControl)
+import IPY_GameWorld
+import DataRecordPack
 
-#---------------------------------------------------------------------
-
-## 收到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, ''
+    queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
+    #playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')
+    if queryType == "IP":
+        return __doForbidTalkByIP(gmCmdDict)
     
-    elif playerName != '':        
-        return GMCommon.Def_DoQueryUserDB, '%s'%GMCommon.Def_GMKey_PlayerName
-    # 回复
-    return GMCommon.Def_ParamErr, ''
+    errorMsg = ""    
+    from GMToolLogicProcess import ProjSpecialProcess
+    Result, curPlayer = ProjSpecialProcess.GMCmdPlayerValidation(gmCmdDict)
+    if Result != GMCommon.Def_Success:
+        return Result, errorMsg
+    if not curPlayer:
+        return Result, "玩家不在线,上线后自动处理"
     
+    # 玩家在线,可处理
+    playerID = curPlayer.GetPlayerID()
+    Result = GMCommon.Def_Unknow
+    #GMT_Name = gmCmdDict.get(GMCommon.Def_GMKey_Type, '') 
     
-## 查询logdb返回
-# @param logdb:logdb
-# @param data:传入的信息
-# @param gmCmdDict:gm命令字典
-# @return None 
-def LogDBResponse(logdb, data, gmCmdDict):
-    playerAccID = gmCmdDict.get(GMCommon.Def_GMKey_PlayerAccID, '')
+    forbidType = gmCmdDict.get("forbidType", '')
+    isDevice = gmCmdDict.get("isDevice", '')
+    forbitDay = GameWorld.ToIntDef(gmCmdDict.get("forbitDay", '0'))
+    forbitHour = GameWorld.ToIntDef(gmCmdDict.get("forbitHour", '0'))
+    forbitMinute = GameWorld.ToIntDef(gmCmdDict.get("forbitMinute", '0'))
     
-    # 玩家在线
-    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 forbidType == "1":
+        if forbitDay <= 0 and forbitHour <= 0 and forbitMinute <= 0:
+            return GMCommon.Def_ParamErr, "需设置禁言时长"
+        forbitTotalMinute = forbitDay * 24 * 60 + forbitHour * 60 + forbitMinute # 禁言时长
         
-        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, ''
+        curFindPlayer_GMOper = curPlayer.GetGMOperManager()
+        gmOper = curFindPlayer_GMOper.AddGMOper(IPY_GameWorld.gmForbidTalk)
+        gmOper.SetGMAccID(curPlayer.GetAccID())
+        gmOper.SetLastTime(forbitTotalMinute)
+        curFindPlayer_GMOper.Sync_SaveToDB()
+                
+        GameWorld.Log("禁言分钟=%s,isDevice=%s,endTime=%s" % (forbitTotalMinute, isDevice, str(gmOper.GetEndTime())), playerID)
+        if isDevice:
+            PlayerControl.SetGMForbidenTalk(curPlayer, 2)
+        PlayerControl.SetGMForbidenTalk(curPlayer, 1)
+        #PlayerControl.NotifyCode(curFindPlayer, "GeRen_chenxin_80731", [lastTime])
+        DataRecordPack.DR_ToolGMOperate(playerID, curPlayer.GetPlayerName(), curPlayer.GetAccID(), "GMTFobidTalk")
         
-    # 设置玩家账号状态
-    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)
+    # 解禁
+    else:
+        curFindPlayer_GMOper = curPlayer.GetGMOperManager()
+        for index in range(curFindPlayer_GMOper.GetCount()):
+            curOper = curFindPlayer_GMOper.GetAt(index)
+            if curOper.GetOper() == IPY_GameWorld.gmForbidTalk:
+                curFindPlayer_GMOper.DeleteOper(IPY_GameWorld.gmForbidTalk)
+                curFindPlayer_GMOper.Sync_SaveToDB()
+                break
             
-    # 记录流向
-    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, ''
+        if isDevice:
+            PlayerControl.SetGMForbidenTalk(curPlayer, 3)
+        PlayerControl.SetGMForbidenTalk(curPlayer, 0)
+        #PlayerControl.NotifyCode(curFindPlayer, "GeRen_liubo_97211")
+        #流向
+        DataRecordPack.DR_ToolGMOperate(playerID, curPlayer.GetPlayerName(), curPlayer.GetAccID(), "GMTUnForbidTalk")
+        
+    return GMCommon.Def_Success
 
-
-
-
-
+def __doForbidTalkByIP(gmCmdDict):
+    Result = GMCommon.Def_Unknow
+    # 暂不支持,后续扩展,需要处理全局管理
+    #gmOper = IPY_GameServer.gmForbidTalk
+    #ipManager = GameWorld.GetGameWorld().GetAllDBIPManage()
+    #根据IP筛选,直接禁言
+    #PlayerControl.SetGMForbidenTalk(curFindPlayer, 1)
+    return Result, "暂不支持"

--
Gitblit v1.8.0