From addc1ac8514763bac4ade806985c9f39adc652f8 Mon Sep 17 00:00:00 2001 From: GiteaAdmin Date: Mon, 6 Feb 2023 10:22:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A8=BB=E8=A7=A3=20mybase=20=E6=B8=AC?= =?UTF-8?q?=E8=A9=A6=E5=B8=B3=E8=99=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/MyBaseApiController.cs | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/FrontendWebApi/ApiControllers/MyBaseApiController.cs b/FrontendWebApi/ApiControllers/MyBaseApiController.cs index 141f9b6..2611d2a 100644 --- a/FrontendWebApi/ApiControllers/MyBaseApiController.cs +++ b/FrontendWebApi/ApiControllers/MyBaseApiController.cs @@ -58,39 +58,39 @@ namespace FrontendWebApi.ApiControllers userinfo_guid = User.Claims.Where(a => a.Type == "userinfo_guid").Select(e => e.Value).FirstOrDefault(), }; - //if (myUser.exp == 0) - //{ - // jwt_str = "Jwt Token不合法"; - // jwtlife = false; - // filterContext.Result = new JsonResult(new { HttpStatusCode.Unauthorized }); - //} - //else - //{ - // if (myUser.exp <= DateTime.Now.AddHours(-8).AddMinutes(10).Subtract(new DateTime(1970, 1, 1)).TotalSeconds) - // { - // jwtlife = true; - // JwtLogin jwtLoing = new JwtLogin() - // { - // account = myUser.account, - // email = myUser.email, - // full_name = myUser.full_name, - // userinfo_guid = myUser.userinfo_guid - // }; - // jwt_str = jwt.GenerateToken(jwtLoing).token; - // } - //} - if (myUser.exp <= DateTime.Now.AddHours(-8).AddMinutes(10).Subtract(new DateTime(1970, 1, 1)).TotalSeconds) + if (myUser.exp == 0) { - jwtlife = true; - JwtLogin jwtLoing = new JwtLogin() + jwt_str = "Jwt Token不合法"; + jwtlife = false; + filterContext.Result = new JsonResult(new { HttpStatusCode.Unauthorized }); + } + else + { + if (myUser.exp <= DateTime.Now.AddHours(-8).AddMinutes(10).Subtract(new DateTime(1970, 1, 1)).TotalSeconds) { - account ="webUser", - email = "webUser@gmail.com", - full_name = "webUser", - userinfo_guid = "6ac24708-3a40-4199-88c5-22df310cd1a8" - }; - jwt_str = jwt.GenerateToken(jwtLoing).token; - } + jwtlife = true; + JwtLogin jwtLoing = new JwtLogin() + { + account = myUser.account, + email = myUser.email, + full_name = myUser.full_name, + userinfo_guid = myUser.userinfo_guid + }; + jwt_str = jwt.GenerateToken(jwtLoing).token; + } + } + //if (myUser.exp <= DateTime.Now.AddHours(-8).AddMinutes(10).Subtract(new DateTime(1970, 1, 1)).TotalSeconds) + //{ + // jwtlife = true; + // JwtLogin jwtLoing = new JwtLogin() + // { + // account ="webUser", + // email = "webUser@gmail.com", + // full_name = "webUser", + // userinfo_guid = "6ac24708-3a40-4199-88c5-22df310cd1a8" + // }; + // jwt_str = jwt.GenerateToken(jwtLoing).token; + //} base.OnActionExecuting(filterContext); } }