zhoufan лет назад: 4
Родитель
Сommit
d79d3ed01f

+ 9 - 2
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Base/BaseController.cs

10
 {
10
 {
11
     public class BaseController : Controller
11
     public class BaseController : Controller
12
     {
12
     {
13
-        public new FormsPrincipal<Cache.Models.CurrentUserInfo> CurrentUser
13
+        public FormsPrincipal<Cache.Models.CurrentUserInfo> CurrentUser
14
         {
14
         {
15
             get
15
             get
16
             {
16
             {
17
-                return (FormsPrincipal<Cache.Models.CurrentUserInfo>)base.User;
17
+                try
18
+                {
19
+                    return (FormsPrincipal<Cache.Models.CurrentUserInfo>)base.User;
20
+                }
21
+                catch
22
+                {
23
+                    return null;
24
+                }
18
             }
25
             }
19
         }
26
         }
20
         /// <summary>
27
         /// <summary>

+ 4 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Startup.cs

21
             {
21
             {
22
                 Authorization = new[] { new CustomAuthorizeFilter() }
22
                 Authorization = new[] { new CustomAuthorizeFilter() }
23
             });
23
             });
24
-            app.UseHangfireServer();
24
+            app.UseHangfireServer(new BackgroundJobServerOptions()
25
+            {
26
+                Queues = new[] { "updatedata1", "updatedata2", "updatedata3", "updatedata4" }
27
+            });
25
             RecurringJob.AddOrUpdate<GetController>(a => a.Data1(1), Cron.Hourly, TimeZoneInfo.Local,"updatedata1");
28
             RecurringJob.AddOrUpdate<GetController>(a => a.Data1(1), Cron.Hourly, TimeZoneInfo.Local,"updatedata1");
26
             RecurringJob.AddOrUpdate<GetController>(a => a.Data2(1), Cron.Hourly, TimeZoneInfo.Local, "updatedata2");
29
             RecurringJob.AddOrUpdate<GetController>(a => a.Data2(1), Cron.Hourly, TimeZoneInfo.Local, "updatedata2");
27
             RecurringJob.AddOrUpdate<GetController>(a => a.Data3(1), Cron.Hourly, TimeZoneInfo.Local, "updatedata3");
30
             RecurringJob.AddOrUpdate<GetController>(a => a.Data3(1), Cron.Hourly, TimeZoneInfo.Local, "updatedata3");

+ 15 - 8
codegit/CallCenterCommon/CallCenter.Utility/RequestString.cs

460
         /// <returns>当前页面客户端的IP</returns>
460
         /// <returns>当前页面客户端的IP</returns>
461
         public static string GetIP()
461
         public static string GetIP()
462
         {
462
         {
463
-            string result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
464
-            if (string.IsNullOrEmpty(result))
465
-                result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
463
+            try
464
+            {
465
+                string result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
466
+                if (string.IsNullOrEmpty(result))
467
+                    result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
466
 
468
 
467
-            if (string.IsNullOrEmpty(result))
468
-                result = HttpContext.Current.Request.UserHostAddress;
469
+                if (string.IsNullOrEmpty(result))
470
+                    result = HttpContext.Current.Request.UserHostAddress;
469
 
471
 
470
-            if (string.IsNullOrEmpty(result) || !ValidateString.IsIP(result))
471
-                return "127.0.0.1";
472
+                if (string.IsNullOrEmpty(result) || !ValidateString.IsIP(result))
473
+                    return "127.0.0.1";
472
 
474
 
473
-            return result;
475
+                return result;
476
+            }
477
+            catch
478
+            {
479
+                return "127.0.0.1";
480
+            }
474
         }
481
         }
475
 
482
 
476
         /// <summary>
483
         /// <summary>

+ 1 - 1
codegit/CallCenterCommon/CallCenter.Utility/log/LogFactory.cs

9
     {
9
     {
10
         static LogFactory()
10
         static LogFactory()
11
         {
11
         {
12
-            FileInfo configFile = new FileInfo(HttpContext.Current.Server.MapPath("/Configs/log4net.config"));
12
+            FileInfo configFile = new FileInfo(System.Web.Hosting.HostingEnvironment.MapPath("/Configs/log4net.config"));
13
             log4net.Config.XmlConfigurator.Configure(configFile);
13
             log4net.Config.XmlConfigurator.Configure(configFile);
14
         }
14
         }
15
         public static Log GetLogger(Type type)
15
         public static Log GetLogger(Type type)