From 8f479da90a78ea9001608fef4b0827eb8bb06612 Mon Sep 17 00:00:00 2001 From: zhangpeihang <948869991@qq.com> Date: Sat, 29 Jan 2022 14:59:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=99=BB=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AccountController.cs | 10 ++++------ src/vue/api/BootstrapAdmin.Api/Models/LoginResult.cs | 8 +++++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/vue/api/BootstrapAdmin.Api/Controllers/AccountController.cs b/src/vue/api/BootstrapAdmin.Api/Controllers/AccountController.cs index 3a8f84b1..ec7dcbed 100644 --- a/src/vue/api/BootstrapAdmin.Api/Controllers/AccountController.cs +++ b/src/vue/api/BootstrapAdmin.Api/Controllers/AccountController.cs @@ -6,7 +6,6 @@ using BootstrapAdmin.Api.Authencation; using BootstrapAdmin.Api.Extensions; using BootstrapAdmin.Api.Models; using BootstrapAdmin.Web.Core; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace BootstrapAdmin.Api.Controllers; @@ -14,9 +13,8 @@ namespace BootstrapAdmin.Api.Controllers; /// /// /// -[Route("api/[controller]/[action]")] +[Route("api/[controller]")] [ApiController] -[Authorize] public class AccountController : ControllerBase { private IUser UserService { get; } @@ -32,7 +30,7 @@ public class AccountController : ControllerBase /// /// [HttpPost] - public ActionResult Login([FromServices] IConfiguration configuration, [FromBody] LoginUser user) + public ActionResult Post([FromServices] IConfiguration configuration, [FromBody] LoginUser user) { string? token = null; string? refershtoken = null; @@ -49,12 +47,12 @@ public class AccountController : ControllerBase op.SecurityKey = tokenOption.SecurityKey; }); refershtoken = BootstrapAdminJwtHandler.CreateRefershToken(); - return new LoginResult { Code = "account:200", Message = "login successed!", Token = token, RefershToken = refershtoken }; + return new LoginResult { Code = "0", Message = "login successed!", Result = new Result { Token = token, RefershToken = refershtoken } }; } else { - return new LoginResult { Code = "account:400", Message = "login failed!", Token = token, RefershToken = refershtoken }; + return new LoginResult { Code = "0", Message = "login failed!", Result = new Result { Token = token, RefershToken = refershtoken } }; } } } diff --git a/src/vue/api/BootstrapAdmin.Api/Models/LoginResult.cs b/src/vue/api/BootstrapAdmin.Api/Models/LoginResult.cs index 148217ab..ac1a9d95 100644 --- a/src/vue/api/BootstrapAdmin.Api/Models/LoginResult.cs +++ b/src/vue/api/BootstrapAdmin.Api/Models/LoginResult.cs @@ -22,10 +22,12 @@ public class LoginResult /// /// /// + public Result? Result { get; set; } +} + +public class Result +{ public string? Token { get; set; } - /// - /// - /// public string? RefershToken { get; set; } }