|
|
@@ -1,4 +1,5 @@
|
|
1
|
1
|
using CallCenter.Utility;
|
|
|
2
|
+using System.Collections.Generic;
|
|
2
|
3
|
using System.Web.Mvc;
|
|
3
|
4
|
|
|
4
|
5
|
namespace CallCenterApi.Interface
|
|
|
@@ -12,7 +13,8 @@ namespace CallCenterApi.Interface
|
|
12
|
13
|
WriteLog(context);
|
|
13
|
14
|
context.ExceptionHandled = true;
|
|
14
|
15
|
context.HttpContext.Response.StatusCode = 200;
|
|
15
|
|
- context.Result = new ContentResult { Content = new AjaxResult { state = ResultTypes.error.ToString(), message = context.Exception.ToString()}.ToJson() };
|
|
|
16
|
+ //context.Result = new ContentResult { Content = new AjaxResult { state = ResultTypes.error.ToString(), message = context.Exception.ToString()}.ToJson() };
|
|
|
17
|
+ context.Result = new ContentResult { Content = new AjaxResult { state = ResultTypes.error.ToString(), message = "系统异常,请稍后重试" }.ToJson() };
|
|
16
|
18
|
}
|
|
17
|
19
|
|
|
18
|
20
|
private void WriteLog(ExceptionContext context)
|
|
|
@@ -20,8 +22,22 @@ namespace CallCenterApi.Interface
|
|
20
|
22
|
if (context == null)
|
|
21
|
23
|
return;
|
|
22
|
24
|
var actionName = context.RouteData.Values["Action"];
|
|
23
|
|
- var log = LogFactory.GetLogger(context.Controller.ToString()+"/"+actionName);
|
|
24
|
|
- log.Error(context.Exception.ToString());
|
|
|
25
|
+ var log = LogFactory.GetLogger(context.Controller.ToString() + "/" + actionName);
|
|
|
26
|
+
|
|
|
27
|
+ var rt = context.RequestContext.HttpContext.Request;
|
|
|
28
|
+ Dictionary<string, string> Params = new Dictionary<string, string>();
|
|
|
29
|
+ Params.Add("request_url", rt.Url.ToString());
|
|
|
30
|
+
|
|
|
31
|
+ foreach (var key in rt.Params.AllKeys)
|
|
|
32
|
+ {
|
|
|
33
|
+ if (key == "ALL_HTTP")
|
|
|
34
|
+ {
|
|
|
35
|
+ break;
|
|
|
36
|
+ }
|
|
|
37
|
+ Params.Add(key, rt.Params[key]);
|
|
|
38
|
+ }
|
|
|
39
|
+
|
|
|
40
|
+ log.Error(Params.ToJson() + "\r\n" + context.Exception.ToString());
|
|
25
|
41
|
}
|
|
26
|
42
|
}
|
|
27
|
43
|
}
|