From eddeff0b81ea84c3b66ab1b8b7943146f953b0e1 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期一, 13 二月 2023 17:17:05 +0800
Subject: [PATCH] 1.往来单位同步修改(客户、供应商、客户/供应商) 2.往来单位新增/编修 :单位属性改为(客户、供应商、客户/供应商) 3.生产开报工PC端、APP端:外协工序时外协供应商(供应商、客户/供应商) 4.委外工序明细报表:(供应商、客户/供应商) 5.工序定义关联工作站(供应商、客户/供应商) 6.综合看板右上角字段(供应商、客户/供应商) 7.采购订单看板(供应商、客户/供应商) 8.采购订单关闭接口开发

---
 VueWebApi/Tools/ChannelActionFilterAttribute.cs |   47 +++++++++++++++++++++++++++++------------------
 1 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/VueWebApi/Tools/ChannelActionFilterAttribute.cs b/VueWebApi/Tools/ChannelActionFilterAttribute.cs
index f219bd2..ffd4a03 100644
--- a/VueWebApi/Tools/ChannelActionFilterAttribute.cs
+++ b/VueWebApi/Tools/ChannelActionFilterAttribute.cs
@@ -26,32 +26,43 @@
         /// <param name="actionContext"></param>
         public override void  OnActionExecuting(HttpActionContext actionContext)
         {
-            User loginUser = JsonConvert.DeserializeObject<User>(HttpContext.Current.Session["User"].ToString());
-            base.OnActionExecuting(actionContext);
-            //濡傛灉瀛樺湪
-            if (redis.Get<User>("LoginUserID" + loginUser.userid, 0).userid.ToString() != "")
+            try
             {
-                //鑾峰彇redis涓綋鍓嶇敤鎴蜂俊鎭�
-                User r_loginUser = redis.Get<User>("LoginUserID" + loginUser.userid, 0);
-                //濡傛灉session涓殑鐢ㄦ埛usercode鍜宺edis涓殑鐢ㄦ埛usercode鍖归厤
-                if (r_loginUser.usercode.Equals(loginUser.usercode))
+                var rediskey = HttpContext.Current.Request.Cookies["rediskey"].Value.ToString(); 
+                var guid = HttpContext.Current.Request.Cookies["guid"].Value.ToString();
+                base.OnActionExecuting(actionContext);
+                //濡傛灉瀛樺湪
+                if (redis.Get<User>(rediskey, 0).userid.ToString() != "")
                 {
-                    //閲嶇疆杩囨湡鏃堕棿
-                    redis.Set<User>("LoginUserID" + loginUser.userid, loginUser, redis.secondsTimeOut, 0);
+                    //鑾峰彇redis涓綋鍓嶇敤鎴蜂俊鎭�
+                    User r_loginUser = redis.Get<User>(rediskey, 0);
+                    //濡傛灉session涓殑鐢ㄦ埛guid鍜宺edis涓殑鐢ㄦ埛guid鍖归厤
+                    if(r_loginUser.guid.Equals(guid))
+                    {
+                        //閲嶇疆杩囨湡鏃堕棿
+                        redis.KeyExpire(rediskey, redis.secondsTimeOut);
+                    }
+                    else
+                    {
+                        mes.code = "303";
+                        mes.Message = "鐧诲綍宸茶秴鏃�,璇烽噸鏂扮櫥褰�!";
+                        actionContext.Response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(mes), Encoding.GetEncoding("UTF-8"), "application/json") };
+                    }
                 }
-                else
+                else //濡傛灉redis鐧诲綍鐢ㄦ埛涓笉瀛樺湪褰撳墠鐢ㄦ埛
                 {
-                    mes.code = "300";
-                    mes.Message = "璐︽埛宸茶繃鏈�,璇烽噸鏂扮櫥褰�2!";
-                    actionContext.Response = new HttpResponseMessage { StatusCode = HttpStatusCode.Ambiguous, Content = new StringContent(JsonConvert.SerializeObject(mes), Encoding.GetEncoding("UTF-8"), "application/json") };
+                    mes.code = "303";
+                    mes.Message = "鐧诲綍宸茶秴鏃�,璇烽噸鏂扮櫥褰�!";
+                    actionContext.Response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(mes), Encoding.GetEncoding("UTF-8"), "application/json") };
                 }
             }
-            else //濡傛灉redis鐧诲綍鐢ㄦ埛涓笉瀛樺湪褰撳墠鐢ㄦ埛
+            catch (Exception)
             {
-                mes.code = "300";
-                mes.Message = "璐︽埛宸茶繃鏈�,璇烽噸鏂扮櫥褰�1!";
-                actionContext.Response = new HttpResponseMessage { StatusCode = HttpStatusCode.Ambiguous, Content = new StringContent(JsonConvert.SerializeObject(mes), Encoding.GetEncoding("UTF-8"), "application/json") };
+                mes.code = "303";
+                mes.Message = "鐧诲綍宸茶秴鏃�,璇烽噸鏂扮櫥褰�!";
+                actionContext.Response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(mes), Encoding.GetEncoding("UTF-8"), "application/json") };
             }
+           
         }  
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3