From 71a5b8c236d7538053a3a893adccaa0d59798521 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 20 二月 2021 15:26:52 +0800
Subject: [PATCH] 4936 【工具】没有绿的异常报错增加发送运维邮件通知

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
index 7236d4b..21d0311 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
@@ -2024,16 +2024,26 @@
     curPlayer.DebugAnswer(text)
     return
 
+def RaiseException(errorMsg, playerID=0):
+    ## 处理抛出异常信息,debug下直接抛出异常报错信息,否则发送运维邮件提醒
+    ErrLog(errorMsg, playerID)
+    if GetGameWorld().GetDebugLevel():
+        raise Exception(errorMsg)
+    else:
+        SendGameError("MapServerRaiseException", errorMsg)
+    return
 
-# 向运维发送邮件,用于需要紧急处理的信息
-# 此处不包含服务器报错的汇报
-def SendGameStateMail(msgInfo):
-    # 使用方式 向OpenStateUrl 发送Type为GameWarning,那么就会收到一封游戏内容警告邮件,信息为MsgInfo
+def SendGameError(errType, msgInfo=""):
+    ''' 向运维发送邮件,用于需要紧急处理的信息
+    @param errType: 错误类型,自定义即可
+    @param msgInfo: 错误信息,可选
+    '''
     getUrl = ReadChConfig.GetPyMongoConfig("EventReport", "OpenStateUrl")
     groupID = ReadChConfig.GetPyMongoConfig("platform", "GroupID")
     userDBName = ReadChConfig.GetPyMongoConfig("connect", "USER_DB_NAME")
-    getUrl = getUrl + "?Type=GameWarning&groupID=%s&userDBName=%s&MsgInfo=%s"%(groupID, userDBName, urllib.quote_plus(msgInfo))
-    
+    getUrl = getUrl + "?Type=%s&groupID=%s&userDBName=%s&mapID=%s"%(errType, groupID, userDBName, GetMap().GetMapID())
+    if msgInfo:
+        getUrl = getUrl + "&MsgInfo=%s" % urllib.quote_plus(msgInfo)
     GetGameWorld().EventReport_EventReport("", "", "", "", 0, getUrl)
-
+    return
 

--
Gitblit v1.8.0