From 876292b5a092977ac84c1c1699d9f3e45b9be67d Mon Sep 17 00:00:00 2001 From: liaoxujun@qq.com <liaoxujun@qq.com> Date: 星期四, 07 九月 2023 15:29:12 +0800 Subject: [PATCH] 增加是否具有标书编辑功能权限字段,和创建权限订单逻辑 --- DocumentServiceAPI.Application/UserAndLogin/LogInController.cs | 59 ++++++++++++++++++++++++++++++++++------------------------- 1 files changed, 34 insertions(+), 25 deletions(-) diff --git a/DocumentServiceAPI.Application/UserAndLogin/LogInController.cs b/DocumentServiceAPI.Application/UserAndLogin/LogInController.cs index fa1f9fa..1b8bb16 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; @@ -58,7 +60,7 @@ throw Oops.Oh("鐧诲綍淇℃伅鍑洪敊"); if(Parma.ITCode!= itcode) throw Oops.Oh("鐢ㄦ埛鍚嶉敊璇�"); - + IsTokenPass=true; } @@ -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