|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+using CallCenter.Utility;
|
|
|
2
|
+using System;
|
|
|
3
|
+using System.Collections.Generic;
|
|
|
4
|
+using System.Linq;
|
|
|
5
|
+using System.Web;
|
|
|
6
|
+using System.Web.Mvc;
|
|
|
7
|
+
|
|
|
8
|
+namespace CallCenterApi.Interface
|
|
|
9
|
+{
|
|
|
10
|
+ public class ActionAttribute: ActionFilterAttribute
|
|
|
11
|
+ {
|
|
|
12
|
+ public override void OnActionExecuting(ActionExecutingContext filterContext)
|
|
|
13
|
+ {
|
|
|
14
|
+ if (filterContext.Controller.ToString().ToLower() != "login")
|
|
|
15
|
+ {
|
|
|
16
|
+ try
|
|
|
17
|
+ {
|
|
|
18
|
+ var datedue = DateTime.Parse(Configs.GetValue("datedue"));
|
|
|
19
|
+ if (DateTime.Now > datedue)
|
|
|
20
|
+ {
|
|
|
21
|
+ filterContext.Result = new ContentResult() { Content = new AjaxResult { state = ResultTypes.notoken.ToString(), message = "授权过期,请联系厂家" }.ToJson() };
|
|
|
22
|
+ return;
|
|
|
23
|
+ }
|
|
|
24
|
+ }
|
|
|
25
|
+ catch
|
|
|
26
|
+ {
|
|
|
27
|
+ filterContext.Result = new ContentResult() { Content = new AjaxResult { state = ResultTypes.notoken.ToString(), message = "授权过期,请联系厂家" }.ToJson() };
|
|
|
28
|
+ return;
|
|
|
29
|
+ }
|
|
|
30
|
+ }
|
|
|
31
|
+ base.OnActionExecuting(filterContext);
|
|
|
32
|
+ }
|
|
|
33
|
+ }
|
|
|
34
|
+}
|