| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package GM.Commands.GMT_Execfile  | 
| #  | 
| # @todo:Ö´ÐÐÃüÁîÎļþ  | 
| # @author hxp  | 
| # @date 2021-05-19  | 
| # @version 1.0  | 
| #  | 
| # ÏêϸÃèÊö: Ö´ÐÐÃüÁîÎļþ  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #"""Version = 2021-05-19 11:00"""  | 
| #-------------------------------------------------------------------------------  | 
|   | 
| import GMCommon  | 
| import GameWorld  | 
| import DataRecordPack  | 
| import ChConfig  | 
|   | 
| import traceback  | 
| import os  | 
|   | 
| #Â߼ʵÏÖ(ÕâÀïcurPlayer = None)  | 
| ## Ö´ÐÐÂß¼  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò None  | 
| #  @param gmList [cmdIndex,gmAccID,forbidAccIP]  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnExec(orderId, gmCmdDict):   | 
|     queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')  | 
|     playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')  | 
|     cmdInfo = gmCmdDict.get('cmdInfo', '')  | 
|     if not cmdInfo:  | 
|         GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)  | 
|         return  | 
|       | 
|     if playerFind:  | 
|           | 
|         if queryType == GMCommon.Def_GMKey_PlayerAccID:  | 
|             queryType = ChConfig.queryType_sqtPlayerByAccID  | 
|               | 
|         elif queryType == GMCommon.Def_GMKey_PlayerName:  | 
|             queryType = ChConfig.queryType_sqtPlayerByName  | 
|               | 
|         GMCommon.GMTool_MapServer_Query(queryType, orderId, playerFind, gmCmdDict, "GMTExecfile", [orderId, cmdInfo], False)  | 
|         return  | 
|       | 
|     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):  | 
|         GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr, "%s is not exists!" % cmdInfo)  | 
|         return  | 
|       | 
|     resultDict = {"cmdInfo":cmdInfo}  | 
|       | 
|     try:  | 
|         execfile(execfilepath, globals(), locals())  | 
|     except:  | 
|         errMsg = traceback.format_exc()  | 
|         GameWorld.ErrLog(errMsg)  | 
|           | 
|         resultDict["errMsg"] = errMsg  | 
|         GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Unknow, resultDict)  | 
|         return  | 
|       | 
|     DataRecordPack.DR_ToolGMOperate(0, "", "", "GMT_Execfile", resultDict)  | 
|     GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, resultDict)  | 
|     return  | 
|   | 
|   |