From c827fe7b0c5b3b444d76ba0d96a2649c764630dd Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 14 十一月 2024 16:36:08 +0800
Subject: [PATCH] 修改WCS、WMS出入库逻辑

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_UserController.cs |   43 +++++++++++++++++++++++++++++++++++++------
 1 files changed, 37 insertions(+), 6 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_UserController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_UserController.cs"
index dc3ea2f..3a25466 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_UserController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_UserController.cs"
@@ -1,5 +1,4 @@
-锘�
-using Microsoft.AspNetCore.Authorization;
+锘縰sing Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Caching.Memory;
@@ -7,11 +6,12 @@
 using WIDESEA_Core;
 using WIDESEA_Core.Authorization;
 using WIDESEA_Core.BaseController;
+using WIDESEA_Core.Caches;
 using WIDESEA_Core.Const;
 using WIDESEA_Core.Helper;
 using WIDESEA_Core.HttpContextUser;
 using WIDESEA_Core.Utilities;
-using WIDESEA_IServices;
+using WIDESEA_ISystemService;
 using WIDESEA_Model;
 using WIDESEA_Model.Models;
 
@@ -22,10 +22,12 @@
     public class Sys_UserController : ApiBaseController<ISys_UserService, Sys_User>
     {
         private readonly IHttpContextAccessor _httpContextAccessor;
+        private readonly ICacheService _cacheService;
 
-        public Sys_UserController(ISys_UserService userService, IHttpContextAccessor httpContextAccessor) : base(userService)
+        public Sys_UserController(ISys_UserService userService, IHttpContextAccessor httpContextAccessor, ICacheService cacheService) : base(userService)
         {
             _httpContextAccessor = httpContextAccessor;
+            _cacheService = cacheService;
         }
 
         [HttpPost, Route("login"), AllowAnonymous]
@@ -33,6 +35,7 @@
         {
             return Json(Service.Login(loginInfo));
         }
+
         [HttpPost, Route("getCurrentUserInfo")]
         public WebResponseContent GetCurrentUser()
         {
@@ -40,9 +43,9 @@
         }
 
         [HttpPost, Route("modifyPwd")]
-        public IActionResult ModifyPwd(string oldPwd, string newPwd)
+        public IActionResult ModifyPwd(string oldPwd, string newPwd, string userName)
         {
-            return Json( Service.ModifyPwd(oldPwd, newPwd));
+            return Json(Service.ModifyPwd(oldPwd, newPwd, userName));
         }
 
         [HttpGet, Route("getVierificationCode"), AllowAnonymous]
@@ -63,5 +66,33 @@
         {
             return WebResponseContent.Instance.OK(data: JwtHelper.SerializeJwt(code));
         }
+        [HttpPost, Route("replaceToken")]
+        public WebResponseContent ReplaceToken()
+        {
+            WebResponseContent responseContent = new WebResponseContent();
+            try
+            {
+                string token = App.User.GetToken();
+                if (string.IsNullOrEmpty(token))
+                {
+                    return responseContent = WebResponseContent.Instance.Error("token鏃犳晥锛岃閲嶆柊鐧诲綍锛�");
+                }
+                TokenModelJwt tokenModelJwt = new TokenModelJwt()
+                {
+                    RoleId = App.User.RoleId,
+                    TenantId = App.User.TenantId,
+                    UserId = App.User.UserId,
+                    UserName = App.User.UserName
+                };
+                string newToken = JwtHelper.IssueJwt(tokenModelJwt);
+                _cacheService.AddOrUpdate(tokenModelJwt.UserId.ToString(), newToken);
+                return responseContent = WebResponseContent.Instance.OK(data: newToken);
+            }
+            catch (Exception ex)
+            {
+                return responseContent.Error(ex.Message);
+            }
+
+        }
     }
 }

--
Gitblit v1.9.3