From b166c0f80252ab4e1af4136789cb976364b779b2 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期一, 21 十一月 2022 15:12:04 +0800
Subject: [PATCH] 大岛的登陆接口存redis加企业区分

---
 VueWebApi/DLL/DAL/LoginDAL.cs |   86 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 82 insertions(+), 4 deletions(-)

diff --git a/VueWebApi/DLL/DAL/LoginDAL.cs b/VueWebApi/DLL/DAL/LoginDAL.cs
index c363236..234f067 100644
--- a/VueWebApi/DLL/DAL/LoginDAL.cs
+++ b/VueWebApi/DLL/DAL/LoginDAL.cs
@@ -1,6 +1,7 @@
 锘縰sing Dapper;
 using System;
 using System.Collections.Generic;
+using System.Configuration;
 using System.Data;
 using System.Data.SqlClient;
 using System.Linq;
@@ -19,13 +20,15 @@
         public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
         public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
         public static string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"];
+        //鑾峰彇浼佷笟閰嶇疆Enterprise
+        private static readonly string Enterprise = ConfigurationManager.AppSettings["Enterprise"];
 
         #region [鐧诲綍鏌ヨ]
         public static DataTable LoginSearch(string username, string password)
         {
 
             //鎵цsql
-            strProcName = "select *  from [dbo].[TUser] where usercode=@username and password=@password";
+            strProcName = "select *  from [dbo].[TUser] where usercode=@username and password=@password and is_delete='0'";
             //鍒涘缓鍙傛暟
             listStr.Add(new SqlParameter("@username", username));
             listStr.Add(new SqlParameter("@password", password));
@@ -163,7 +166,7 @@
         }
         #endregion
 
-      
+
 
         #region[淇敼瀵嗙爜]
         public static ToMessage UpdateUserPassword(string usercode, string username, string password, string newpassword)
@@ -223,7 +226,7 @@
         }
         #endregion
 
-        #region[鐧诲嚭]
+        #region[PC鐧诲嚭]
         public static ToMessage LoginOut(int userid, string usercode, string username, string usertype)
         {
             var sql = "";
@@ -239,7 +242,7 @@
                 cont = DapperHelper.SQL(sql, dynamicParams);
                 if (cont > 0)
                 {
-                    redis.Remove("LoginUserID" + usertype + userid, 0); //鍒犻櫎redis
+                    redis.Remove(Enterprise+"LoginUserID" + usertype + userid, 0); //鍒犻櫎redis
                     mes.code = "200";
                     mes.count = 0;
                     mes.Message = "鐧诲嚭鎴愬姛!";
@@ -263,5 +266,80 @@
             return mes;
         }
         #endregion
+
+        #region[App鐧诲嚭]
+        public static ToMessage LoginAppOut(int userid, string usercode, string username, string usertype)
+        {
+            var sql = "";
+            var cont = 0;
+            var dynamicParams = new DynamicParameters();
+            RedisHelper redis = new RedisHelper();
+            try
+            {
+                sql = @"update T_Bas_Login set outdate=@outdate,status='N'  where usercode=@usercode and origin=@usertype";
+                dynamicParams.Add("@usercode", usercode);
+                dynamicParams.Add("@outdate", DateTime.Now.ToString());
+                dynamicParams.Add("@usertype", usertype);
+                cont = DapperHelper.SQL(sql, dynamicParams);
+                if (cont > 0)
+                {
+                    mes.code = "200";
+                    mes.count = 0;
+                    mes.Message = "鐧诲嚭鎴愬姛!";
+                    mes.data = null;
+                }
+                else
+                {
+                    mes.code = "300";
+                    mes.count = 0;
+                    mes.Message = "鐧诲嚭澶辫触!";
+                    mes.data = null;
+                }
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[App鐧诲綍鏌ヨ瀹夌伅鍛煎彨淇℃伅]
+        public static ToMessage LoginAppAnDonMessage(int userid, string usercode, string username, string usertype)
+        {
+            var sql = "";
+            var dynamicParams = new DynamicParameters();
+            RedisHelper redis = new RedisHelper();
+            try
+            {
+                sql = @"select B.eqp_code,E.name as eqp_name,B.wkshp_code,T.org_name as wkshp_name,
+                        A.type as typecode,D.name as typename,B.start_user,B.start_date   
+                        from TAnDnMessagePush A
+                        inner join TAnDon_Task_Info B on A.m_id=B.id
+                        left  join TEqpInfo E on B.eqp_code=E.code
+                        left  join TOrganization T on B.wkshp_code=T.org_code 
+                        left  join TAnDonType D on A.type=d.code
+                        where A.resp_user=@username and B.status='START' and T.description='W'";
+                dynamicParams.Add("@username", username);
+                var data = DapperHelper.selectdata(sql, dynamicParams);
+
+                mes.code = "200";
+                mes.count = 0;
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.data = data;
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3