From 70233af5426b0d1c343ebe87183303a34a9aaa58 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期三, 20 十一月 2024 09:05:38 +0800
Subject: [PATCH] WIDESEAWCS_QuartzJob更新版本

---
 WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs b/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs
index 85d5afa..568c8ca 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs
@@ -10,15 +10,20 @@
 using WIDESEAWCS_ISystemRepository;
 using WIDESEAWCS_Core.BaseRepository;
 using System.Net;
+using WIDESEAWCS_Core.Caches;
 
 namespace WIDESEAWCS_SystemServices
 {
     public class Sys_UserService : ServiceBase<Sys_User, ISys_UserRepository>, ISys_UserService
     {
         private readonly IUnitOfWorkManage _unitOfWorkManage;
-        public Sys_UserService(ISys_UserRepository repository, IUnitOfWorkManage unitOfWorkManage) : base(repository)
+        private readonly ICacheService _cacheService;
+        private readonly ISys_MenuService _menuService;
+        public Sys_UserService(ISys_UserRepository repository, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService, ISys_MenuService menuService) : base(repository)
         {
             _unitOfWorkManage = unitOfWorkManage;
+            _cacheService = cacheService;
+            _menuService = menuService;
         }
 
         public WebResponseContent Login(LoginInfo loginInfo)
@@ -44,6 +49,16 @@
                 UserInfo user = BaseDal.GetUserInfo(loginInfo.UserName, loginInfo.Password);
                 if (user != null)
                 {
+                    object obj = _menuService.GetMenuActionList(user.RoleId);
+                    if (obj is not IEnumerable<object> list)
+                    {
+                        return WebResponseContent.Instance.Error("鏃犵櫥褰曟潈闄�");
+                    }
+                    if (!list.Any())
+                    {
+                        return WebResponseContent.Instance.Error("鏃犵櫥褰曟潈闄�");
+                    }
+
                     string token = JwtHelper.IssueJwt(new TokenModelJwt()
                     {
                         UserId = user.UserId,
@@ -51,6 +66,8 @@
                         UserName = user.UserName,
                         TenantId = user.TenantId,
                     });
+
+                    _cacheService.AddOrUpdate(user.UserId.ToString(), token);
 
                     content = WebResponseContent.Instance.OK(data: new { token, userName = user.UserTrueName, img = user.HeadImageUrl });
                 }
@@ -107,11 +124,11 @@
             {
                 s.UserName,
                 s.UserTrueName,
-                s.Address,
-                s.PhoneNo,
-                s.Email,
+                //s.Address,
+                //s.PhoneNo,
+                //s.Email,
                 s.Remark,
-                s.Gender,
+                //s.Gender,
                 s.RoleName,
                 s.HeadImageUrl,
                 s.CreateDate

--
Gitblit v1.9.3