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/Controllers/LoginController.cs |   64 +++++++++++++++++++++++++------
 1 files changed, 51 insertions(+), 13 deletions(-)

diff --git a/VueWebApi/Controllers/LoginController.cs b/VueWebApi/Controllers/LoginController.cs
index 94987c1..3e66357 100644
--- a/VueWebApi/Controllers/LoginController.cs
+++ b/VueWebApi/Controllers/LoginController.cs
@@ -1,6 +1,7 @@
 锘縰sing Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
+using System.Configuration;
 using System.Data;
 using System.Linq;
 using System.Net;
@@ -20,6 +21,10 @@
         //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
         ToMessage mes = new ToMessage();
         RedisHelper redis = new RedisHelper();
+        //鑾峰彇浼佷笟閰嶇疆Enterprise
+        private static readonly string Enterprise = ConfigurationManager.AppSettings["Enterprise"];
+
+
 
         #region[PC鐢ㄦ埛鐧诲綍]
         /// <summary>
@@ -46,18 +51,18 @@
                     ms.username = dt.Rows[0]["USERNAME"].ToString();
                     ms.password = dt.Rows[0]["PASSWORD"].ToString();
                     ms.usertype = usertype;
-                    ms.rediskey = "LoginUserID" + ms.usertype + ms.userid;
+                    ms.rediskey = Enterprise+"LoginUserID" + ms.usertype + ms.userid;
                     mss.Add(ms);
                     HttpContext.Current.Session.Clear(); //浠庝細璇濈姸鎬侀泦鍚堜腑鍒犻櫎鎵�鏈夌殑閿��
                     //HttpContext.Current.Session["User"] = JsonConvert.SerializeObject(ms);
                     //User loginUser = JsonConvert.DeserializeObject<User>(HttpContext.Current.Session["User"].ToString());
                     User loginUser = JsonConvert.DeserializeObject<User>(JsonConvert.SerializeObject(ms));
                     //濡傛灉redis鐧诲綍鐢ㄦ埛涓笉瀛樺湪褰撳墠鐢ㄦ埛
-                    if (redis.Get<User>("LoginUserID" + ms.usertype + ms.userid, 0) == null)
+                    if (redis.Get<User>(Enterprise+"LoginUserID" + ms.usertype + ms.userid, 0) == null)
                     {
                         //redis.Remove("LoginUserID" + ms.userid, 0);
                         //鍐欏叆redis(娉ㄦ剰锛歳edis绫婚噷闈㈢殑澶辨晥鏃堕棿蹇呴』鍦╧ey鍒涘缓瀹屾垚涔嬪悗鎵嶇敓鏁�)
-                        redis.Set<User>("LoginUserID" + ms.usertype + ms.userid, ms, redis.secondsTimeOut, 0);
+                        redis.Set<User>(Enterprise+"LoginUserID" + ms.usertype + ms.userid, ms, redis.secondsTimeOut, 0);
                         //鐧诲綍淇℃伅鍐欏叆session
                         HttpContext.Current.Session["User"] = JsonConvert.SerializeObject(ms);
                         //鍐欏叆鐧诲綍鎿嶄綔璁板綍
@@ -69,7 +74,7 @@
                     else //濡傛灉瀛樺湪
                     {
                         //鑾峰彇redis涓綋鍓嶇敤鎴蜂俊鎭�
-                        User r_loginUser = redis.Get<User>("LoginUserID" + ms.usertype + ms.userid, 0);
+                        User r_loginUser = redis.Get<User>(Enterprise+"LoginUserID" + ms.usertype + ms.userid, 0);
                         //濡傛灉session涓殑鐢ㄦ埛usercode鍜宺edis涓殑鐢ㄦ埛usercode鍖归厤
                         if ((r_loginUser.usercode + r_loginUser.usertype).Equals(loginUser.usercode + loginUser.usertype))
                         {
@@ -80,7 +85,7 @@
                         else
                         {
                             //閲嶇疆杩囨湡鏃堕棿(娉ㄦ剰锛歳edis绫婚噷闈㈢殑澶辨晥鏃堕棿蹇呴』鍦╧ey鍒涘缓瀹屾垚涔嬪悗鎵嶇敓鏁�)
-                            redis.Set<User>("LoginUserID" + ms.usertype + loginUser.userid, loginUser, redis.secondsTimeOut, 0);
+                            redis.Set<User>(Enterprise+"LoginUserID" + ms.usertype + loginUser.userid, loginUser, redis.secondsTimeOut, 0);
                             //鐧诲綍淇℃伅鍐欏叆session
                             HttpContext.Current.Session["User"] = JsonConvert.SerializeObject(ms);
                             //鍐欏叆鐧诲綍鎿嶄綔璁板綍
@@ -138,11 +143,11 @@
                     sql = @"update [dbo].[TUser] set rid=@rid where usercode=@usercode";
                     list.Add(new { str = sql, parm = new { rid = rid, usercode = username } });
                     bool aa = DapperHelper.DoTransaction(list);
-                    redis.Remove("LoginUserID" + usertype + userid, 1); //鍒犻櫎redis
+                    redis.Remove(Enterprise+"LoginUserID" + usertype + userid, 1); //鍒犻櫎redis
                 }
                 else 
                 {
-                    redis.Remove("LoginUserID" + usertype + userid, 0); //鍒犻櫎redis
+                    redis.Remove(Enterprise+"LoginUserID" + usertype + userid, 0); //鍒犻櫎redis
                 }
                 mes.code = "200";
                 mes.count = 0;
@@ -253,15 +258,15 @@
                     ms.username = dt.Rows[0]["USERNAME"].ToString();
                     ms.password = dt.Rows[0]["PASSWORD"].ToString();
                     ms.usertype = usertype;
-                    ms.rediskey = "LoginUserID" + ms.usertype + ms.userid;
+                    ms.rediskey = Enterprise+"LoginUserID" + ms.usertype + ms.userid;
                     mss.Add(ms);
                     HttpContext.Current.Session.Clear(); //浠庝細璇濈姸鎬侀泦鍚堜腑鍒犻櫎鎵�鏈夌殑閿��
                     User loginUser = JsonConvert.DeserializeObject<User>(JsonConvert.SerializeObject(ms));
                     //濡傛灉redis鐧诲綍鐢ㄦ埛涓笉瀛樺湪褰撳墠鐢ㄦ埛
-                    if (redis.Get<User>("LoginUserID" + ms.usertype + ms.userid, 1) == null)
+                    if (redis.Get<User>(Enterprise+"LoginUserID" + ms.usertype + ms.userid, 1) == null)
                     {
                         //鍐欏叆redis(娉ㄦ剰锛歳edis绫婚噷闈㈢殑澶辨晥鏃堕棿蹇呴』鍦╧ey鍒涘缓瀹屾垚涔嬪悗鎵嶇敓鏁�)
-                        redis.Set<User>("LoginUserID" + ms.usertype + ms.userid, ms, redis.secondsTimeOut, 1);
+                        redis.Set<User>(Enterprise+"LoginUserID" + ms.usertype + ms.userid, ms, redis.secondsTimeOut, 1);
                         //鐧诲綍淇℃伅鍐欏叆session
                         HttpContext.Current.Session["User"] = JsonConvert.SerializeObject(ms);
                         //鏇存柊rid
@@ -277,7 +282,7 @@
                     else //濡傛灉瀛樺湪
                     {
                         //鑾峰彇redis涓綋鍓嶇敤鎴蜂俊鎭�
-                        User r_loginUser = redis.Get<User>("LoginUserID" + ms.usertype + ms.userid, 1);
+                        User r_loginUser = redis.Get<User>(Enterprise+"LoginUserID" + ms.usertype + ms.userid, 1);
                         //濡傛灉session涓殑鐢ㄦ埛usercode鍜宺edis涓殑鐢ㄦ埛usercode鍖归厤
                         if ((r_loginUser.usercode + r_loginUser.usertype).Equals(loginUser.usercode + loginUser.usertype))
                         {
@@ -288,7 +293,7 @@
                         else
                         {
                             //閲嶇疆杩囨湡鏃堕棿(娉ㄦ剰锛歳edis绫婚噷闈㈢殑澶辨晥鏃堕棿蹇呴』鍦╧ey鍒涘缓瀹屾垚涔嬪悗鎵嶇敓鏁�)
-                            redis.Set<User>("LoginUserID" + ms.usertype + loginUser.userid, loginUser, redis.secondsTimeOut, 1);
+                            redis.Set<User>(Enterprise+"LoginUserID" + ms.usertype + loginUser.userid, loginUser, redis.secondsTimeOut, 1);
                             //鐧诲綍淇℃伅鍐欏叆session
                             HttpContext.Current.Session["User"] = JsonConvert.SerializeObject(ms);
                             //鏇存柊rid
@@ -342,6 +347,40 @@
         }
         #endregion
 
+        #region[APP淇敼瀵嗙爜]
+        /// <summary>
+        /// APP淇敼瀵嗙爜
+        /// </summary>
+        /// <param name="usercode">鐢ㄦ埛缂栫爜</param>
+        /// <param name="username">鐢ㄦ埛鍚嶇О</param>
+        /// <param name="password">瀵嗙爜</param>
+        /// <param name="newpassword">鏂板瘑鐮�</param>
+        /// <returns></returns>
+        [ChannelActionFilterAttributeApp, Route(template: "AppUpdateUserPassword")]
+        [HttpPost]
+        public HttpResponseMessage AppUpdateUserPassword(string usercode, string username, string password, string newpassword)
+        {
+            mes = LoginBLL.AppUpdateUserPassword(usercode, username, password, newpassword);
+            return mes.ResponseMess(mes);
+        }
+        #endregion
+
+        #region[APP瀵嗙爜閲嶇疆]
+        /// <summary>
+        /// APP瀵嗙爜閲嶇疆
+        /// </summary>
+        /// <param name="usercode">鐢ㄦ埛缂栧彿</param>
+        /// <param name="username">鐢ㄦ埛鍚嶇О</param>
+        /// <returns></returns>
+        [ChannelActionFilterAttributeApp, Route(template: "ResettUserPassword")]
+        [HttpPost]
+        public HttpResponseMessage ResettUserPassword(string usercode, string username)
+        {
+            mes = LoginBLL.ResettUserPassword(usercode, username);
+            return mes.ResponseMess(mes);
+        }
+        #endregion
+
         #region[APP鐧诲嚭]
         /// <summary>
         /// APP鐧诲嚭
@@ -379,6 +418,5 @@
         }
         #endregion
 
-        
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3