From c9465709c827d68f243a54609ce691f341306b9d Mon Sep 17 00:00:00 2001
From: liaoxujun@qq.com <liaoxujun@qq.com>
Date: 星期四, 28 九月 2023 14:23:58 +0800
Subject: [PATCH] 员工账号校验必须为电话号码

---
 DocumentServiceAPI.Application/UserAndLogin/LogInController.cs |   57 +++++++++++++++++++++++++++++++++------------------------
 1 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/DocumentServiceAPI.Application/UserAndLogin/LogInController.cs b/DocumentServiceAPI.Application/UserAndLogin/LogInController.cs
index 2eed030..08408a7 100644
--- a/DocumentServiceAPI.Application/UserAndLogin/LogInController.cs
+++ b/DocumentServiceAPI.Application/UserAndLogin/LogInController.cs
@@ -1,5 +1,7 @@
 锘縰sing DocumentServiceAPI.Application.UserAndLogin.Services;
 using DocumentServiceAPI.Application.UserAndLogin.ViewMode;
+using DocumentServiceAPI.Model.cyDocumentModel;
+using DocumentServiceAPI.Model.UserInfoModel;
 using DocumentServiceAPI.Utility;
 using Furion.DynamicApiController;
 using Furion.JsonSerialization;
@@ -74,7 +76,7 @@
                         case 0:
                             throw Oops.Oh($"璐︽埛鎴栬�呭瘑鐮侀敊璇�");
                         case 1:
-                        if (!needtoken)
+                        if (!IsTokenPass)
                         {
                             needtoken = await _userService.CheckPsw(Tender[0].TenderId, Tender[0].EmployeeID, Parma.PassWord);
 
@@ -171,6 +173,14 @@
                     if (!needtoken)
                         throw Oops.Oh($"璐︽埛鎴栬�呭瘑鐮侀敊璇�");
                 }
+
+                 var hasPermissions=   await _userService.TenderHasPermissions(Tender.TenderId);
+                if(!hasPermissions)
+                {
+                    throw Oops.Oh($"闆嗗洟鐢ㄨ处鍙凤細{Tender.ItCode}浣跨敤鏈熼檺宸茬粡杩囨湡鎴栬�呮病鏈変娇鐢ㄦ潈闄�");
+                }
+
+
                     var token = _tokenService.CreateToken(new Model.JwtInfo
                     {
                         EID = Tender.EmployeeID,
@@ -193,34 +203,33 @@
 
         }
 
-
-
-
-
-
-     
-
         /// <summary>
-        /// 鑾峰彇鍏徃鍒楄〃
+        /// 鏄惁鏄敤鎴风鎴凤紝鎴栬�呮槸鍛樺伐
         /// </summary>
-        /// <returns>鐧诲綍淇℃伅</returns>      
-        public bool GetUnitList()
+        /// <param name="ITCode">璐﹀彿</param>
+        /// <returns>  杩斿洖true 浠h〃鏄紝 false浠h〃涓嶆槸</returns>
+        [HttpGet("IDIsEmployee")]
+        public async Task<bool> IDIsEmployee(string ITCode, [FromServices] ISqlSugarClient db)
         {
+          var ad=  ITCode.TryValidate(ValidationTypes.PhoneNumber);
+            if(!ad.IsValid)
+            {
+                throw Oops.Oh("鍛樺伐璐﹀彿闇�瑕佺敤鐢佃瘽鍙风爜");
+            }
+              
+          var count= await db.Queryable<TenantInfo>().Where(x=>x.ItCode==ITCode&&x.IsEn==true&&x.IsDel==false).WithCache(600).CountAsync();
+            if (count > 0)
+                return true;
+            count=await db.Queryable<Document_EmployeeInfo>().Where(x=>x.UserName==ITCode).WithCache(600).CountAsync();
+            if (count > 0)
+                return true;
+            return false;
 
-            return true;
         }
-        /// <summary>
-        /// 鑾峰彇鍏徃鍒楄〃
-        /// </summary>
-        /// <returns>鐧诲綍淇℃伅</returns>
-        public bool GetTenantInfoList()
-        {
 
-            return true;
-        }
-        public string Get()
-        {
-            return $"Hello {nameof(Furion)}";
-        }
+
+
+
+
     }
 }

--
Gitblit v1.9.1