#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_Execfile
|
#
|
# @todo:GM¹¤¾ßÃüÁî - Ö´ÐÐÃüÁî
|
# @author hxp
|
# @date 2026-02-13
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: GM¹¤¾ßÃüÁî - Ö´ÐÐÃüÁî
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2026-02-13 14:30"""
|
#-------------------------------------------------------------------------------
|
|
import GMCommon
|
import GameWorld
|
import DataRecordPack
|
import traceback
|
import os
|
|
## ÊÕµ½gmÃüÁîÖ´ÐÐ
|
# @param gmCmdDict:gmÃüÁî×Öµä
|
# @return None
|
def OnExec(gmCmdDict):
|
|
queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
|
playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')
|
cmdInfo = gmCmdDict.get('cmdInfo', '')
|
if not cmdInfo:
|
return GMCommon.Def_ParamErr
|
GMT_Name = gmCmdDict.get(GMCommon.Def_GMKey_Type, '')
|
|
playerID, playerName, accID = 0, "", ""
|
curPlayer = None
|
errorMsg = ""
|
if playerFind:
|
from GMToolLogicProcess import ProjSpecialProcess
|
Result, curPlayer = ProjSpecialProcess.GMCmdPlayerValidation(gmCmdDict, False)
|
if Result != GMCommon.Def_Success:
|
return Result, errorMsg
|
if not curPlayer:
|
return Result, "Íæ¼Ò²»ÔÚÏß"
|
playerID = curPlayer.GetPlayerID()
|
playerName = curPlayer.GetPlayerName()
|
accID = curPlayer.GetAccID()
|
|
backDir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
execfilepath = os.path.join(backDir, "GMTExec\\%s.py" % cmdInfo)
|
GameWorld.Log("GMT_Execfile: %s" % execfilepath)
|
|
if not os.path.exists(execfilepath):
|
return GMCommon.Def_ParamErr, "%s is not exists!" % cmdInfo
|
|
resultDict = {"cmdInfo":cmdInfo}
|
|
try:
|
execfile(execfilepath, globals(), locals())
|
except:
|
errMsg = traceback.format_exc()
|
GameWorld.ErrLog(errMsg)
|
|
resultDict["errMsg"] = errMsg
|
return GMCommon.Def_Unknow, resultDict
|
|
#Á÷Ïò
|
DataRecordPack.DR_ToolGMOperate(playerID, playerName, accID, GMT_Name, resultDict)
|
return GMCommon.Def_Success, resultDict
|