diff --git a/Web.Code/AuthorizationAttribute.cs b/Web.Code/AuthorizationAttribute.cs index 785ef0f4ab7bc04787c60628fd034cd6ffe23d63..325a1e2bbdd90cb8e5674802991949bc4c6ea1dd 100644 --- a/Web.Code/AuthorizationAttribute.cs +++ b/Web.Code/AuthorizationAttribute.cs @@ -25,7 +25,7 @@ namespace Web.Code if (userDto == null) throw new BusinessLogicException(401, "请先登录账号"); if (_power != null) { - if ((sbyte)userDto.Status>(sbyte)_power) + if ((sbyte)userDto.Power>(sbyte)_power) { throw new BusinessLogicException(403, $"您没有权限访问{path}接口!"); } diff --git a/Web/Controllers/LoginController.cs b/Web/Controllers/LoginController.cs index 3e45fc15b0e5b00b9c39151cbfdacf76cb3488a7..03e0d54af630d33e125b2b012f79dad2d5c94507 100644 --- a/Web/Controllers/LoginController.cs +++ b/Web/Controllers/LoginController.cs @@ -50,7 +50,8 @@ namespace Web.Controllers [Description("退出登录")] public async Task ExitLogin() { - _ = await _redis.DeleteAsync(UserToken); + var res = await _redis.DeleteAsync(UserToken); + if (!res) return new ModelStateResult("退出失败", 400); return new OkObjectResult("退出成功"); } /// @@ -61,7 +62,8 @@ namespace Web.Controllers [Description("刷新登录时间")] public async Task Refresh() { - await _redis.SetDateAsync(UserToken, DateTime.Now.AddMinutes(30)); + var res = await _redis.SetDateAsync(UserToken, DateTime.Now.AddMinutes(30)); + if (!res) return new ModelStateResult("刷新登陆时间失败", 400); return new OkObjectResult("刷新成功"); } }