|
@@ -10,6 +10,7 @@ using GxPress.Request.Admin;
|
|
|
using GxPress.Result.Admin;
|
|
|
using GxPress.Service.Interface.Role;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
using Microsoft.Extensions.Options;
|
|
@@ -29,8 +30,8 @@ namespace GxPress.Api.AdminControllers
|
|
|
private readonly IAdminRepository _adminRepository;
|
|
|
|
|
|
private readonly IRoleService roleService;
|
|
|
-
|
|
|
- public AdminController(IOptions<JwtOptions> jwtOptions, ILogger<AdminController> logger, IAdminRepository adminRepository, IRoleService roleService)
|
|
|
+ private readonly IHttpContextAccessor httpContextAccessor;
|
|
|
+ public AdminController(IOptions<JwtOptions> jwtOptions, ILogger<AdminController> logger, IAdminRepository adminRepository, IRoleService roleService, IHttpContextAccessor httpContextAccessor)
|
|
|
{
|
|
|
_jwtOptions = jwtOptions.Value;
|
|
|
_logger = logger;
|
|
@@ -47,6 +48,7 @@ namespace GxPress.Api.AdminControllers
|
|
|
[AllowAnonymous]
|
|
|
public async Task<AdminSignInResult> SignIn(AdminSignInRequest request)
|
|
|
{
|
|
|
+ request.Ip = httpContextAccessor.HttpContext.Connection.LocalIpAddress.ToString();
|
|
|
var result = await _adminRepository.SignInAsync(request);
|
|
|
//获取菜单
|
|
|
result.MenuInResult = await roleService.GetMenusAllAsync(result.RoleId);
|
|
@@ -105,16 +107,7 @@ namespace GxPress.Api.AdminControllers
|
|
|
{
|
|
|
return await _adminRepository.UpdateAsync(id, request);
|
|
|
}
|
|
|
- /// <summary>
|
|
|
- /// 修改
|
|
|
- /// </summary>
|
|
|
- /// <param name="request"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpPut("updatemenu")]
|
|
|
- public async Task<bool> UpdateMenu([FromBody] Admin request)
|
|
|
- {
|
|
|
- return await _adminRepository.UpdateQAsync(request);
|
|
|
- }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 分页列表
|
|
|
/// </summary>
|