zhoufan 4 jaren geleden
bovenliggende
commit
c84435cfc2

+ 4 - 12
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/App_Start/ErrorAttribute.cs

@@ -1,5 +1,4 @@
1 1
 using CallCenter.Utility;
2
-using CallCenterApi.Interface.Models.Common;
3 2
 using System.Collections.Generic;
4 3
 using System.Web.Mvc;
5 4
 
@@ -25,7 +24,8 @@ namespace CallCenterApi.Interface
25 24
             var actionName = context.RouteData.Values["Action"];
26 25
             var log = LogFactory.GetLogger(context.Controller.ToString() + "/" + actionName);
27 26
 
28
-            var rt = context.RequestContext.HttpContext.Request;
27
+            var cnt = context.RequestContext.HttpContext;
28
+            var rt = cnt.Request;
29 29
             Dictionary<string, string> Params = new Dictionary<string, string>();
30 30
             Params.Add("request_url", rt.Url.ToString());
31 31
 
@@ -40,17 +40,9 @@ namespace CallCenterApi.Interface
40 40
                     Params.Add(key, rt.Params[key]);
41 41
                 }
42 42
             }
43
+            string usercode = cnt.User?.Identity.Name ?? "";
43 44
 
44
-            Model.T_Sys_UserAccount usermodel = null;
45
-            try
46
-            {
47
-                var us = (FormsPrincipal<Model.T_Sys_UserAccount>)context.RequestContext.HttpContext.User;
48
-                usermodel = us.UserData;
49
-            }
50
-            catch
51
-            { }
52
-
53
-            log.Error("系统异常,用户账号:" + (usermodel?.F_UserCode ?? "") + ",请求信息:" + Params.ToJson(), context.Exception);
45
+            log.Error("系统异常,操作账号:" + usercode + ",请求信息:" + Params.ToJson(), context.Exception);
54 46
         }
55 47
     }
56 48
 }