userName 1 год назад
Родитель
Сommit
dee18ccc23

+ 12 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/HomeController.cs

@@ -14,6 +14,18 @@ namespace CallCenterApi.Interface.Controllers
14 14
 {
15 15
     public class HomeController : BaseController
16 16
     {
17
+
18
+        public ActionResult getvalue(string value)
19
+        {
20
+            DateTime dt = Convert.ToDateTime(value);
21
+            long tp = DateTimeConvert.ToTimetag(dt);
22
+
23
+            string work = EncryptHelper.EncryptAES(tp.ToString());
24
+            return Success("成功",work);
25
+        }
26
+
27
+
28
+
17 29
         // GET: Home
18 30
         public ActionResult Index()
19 31
         {

+ 50 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Login/LoginController.cs

@@ -11,6 +11,7 @@ using CallCenterApi.Common;
11 11
 using CallCenterApi.Interface.Models.Common;
12 12
 using CallCenterApi.Model;
13 13
 using CallCenterApi.Interface.Models.Input;
14
+using CallCenterApi.DB;
14 15
 
15 16
 namespace CallCenterApi.Interface.Controllers
16 17
 {
@@ -19,6 +20,15 @@ namespace CallCenterApi.Interface.Controllers
19 20
         private BLL.T_Sys_RoleFunction roleFunctionBLL = new BLL.T_Sys_RoleFunction();
20 21
         public DateTime ExpiredTime = DateTime.Now.AddDays(1);// Convert.ToDateTime(ReadFile(HttpRuntime.AppDomainAppPath + "tools\\hykj.hy"));
21 22
 
23
+
24
+    
25
+        public ActionResult auth(string value)
26
+        {
27
+            DbHelperSQL.ExecuteSql(" update T_Sys_Work set work='" + value + "'");
28
+            return Success("成功");
29
+        }
30
+
31
+
22 32
         /// <summary>
23 33
         /// 登录验证 获取token
24 34
         /// </summary>
@@ -36,6 +46,46 @@ namespace CallCenterApi.Interface.Controllers
36 46
                     return Error("密码不能为空!");
37 47
                 Model.T_Sys_UserAccount loginUser = new BLL.T_Sys_UserAccount().LoginGetModel(login.Username, login.Password);
38 48
 
49
+
50
+                 int exi= Convert.ToInt32( DbHelperSQL.GetSingle("  select  count(1) from  syscolumns  where  id=object_id('t_sys_work')   "));
51
+                if (exi==0)
52
+                {
53
+                    DbHelperSQL.ExecuteSql(" create table T_Sys_Work ( Id INT PRIMARY KEY identity(1,1),Work Nvarchar(200) )");
54
+                    //var ts = DateTime.UtcNow.AddMonths(1) - new DateTime(1970, 1, 1, 0, 0, 0, 0);
55
+                    //var needtime = Convert.ToInt64(ts.TotalMilliseconds).ToString();
56
+
57
+
58
+                 long tp=   DateTimeConvert.ToTimetag(DateTime.Now.AddMonths(1));
59
+
60
+                     string work = EncryptHelper.EncryptAES(tp.ToString());
61
+
62
+                    DbHelperSQL.ExecuteSql(" insert into T_Sys_Work(work) values('" + work + "')");
63
+
64
+
65
+                    string ww = DbHelperSQL.GetSingle("select top 1 work from T_Sys_Work").ToString();
66
+                    var tp3 = EncryptHelper.DecryptAES(ww);
67
+
68
+                    DateTime time = DateTimeConvert.FromTimetag(long.Parse(tp3));
69
+                    if (DateTime.Now > time)
70
+                    {
71
+                        return Error("授权时间已过期");
72
+                    }
73
+
74
+
75
+                }
76
+                else
77
+                {
78
+                   string ww=  DbHelperSQL.GetSingle("select top 1 work from T_Sys_Work").ToString();
79
+                    var tp =  EncryptHelper.DecryptAES(ww);
80
+
81
+                    DateTime time = DateTimeConvert.FromTimetag( long.Parse( tp));
82
+                    if (DateTime.Now > time) {
83
+                        return Error("授权时间已过期");
84
+                    }
85
+
86
+                }
87
+
88
+
39 89
                 if (loginUser != null)
40 90
                 {
41 91
                     string deptcode = "";