ruoyi对接

登录接口、用户信息接口、用户管理接口等
This commit is contained in:
陈淳
2022-09-07 18:22:15 +08:00
parent bf17312a5f
commit 781fa7ea1b
8 changed files with 52 additions and 7 deletions

View File

@@ -44,13 +44,17 @@ namespace Yi.Framework.ApiMicroservice.Controllers
[HttpPost]
public async Task<Result> Login(LoginDto loginDto)
{
//跳过
//先效验验证码和UUID
UserEntity user = new();
if (await _iUserService.Login(loginDto.UserName, loginDto.Password, o => user = o))
{
var userRoleMenu= await _iUserService.GetUserAllInfo(user.Id);
return Result.Success("登录成功!").SetData(new { token = _jwtInvoker.GetAccessToken(userRoleMenu.User,userRoleMenu.Menus) });
}
return Result.SuccessError("登录失败!用户名或者密码错误!");
return Result.Error("登录失败!用户名或者密码错误!");
}
/// <summary>
@@ -90,11 +94,13 @@ namespace Yi.Framework.ApiMicroservice.Controllers
{
//通过鉴权jwt获取到用户的id
var userId = HttpContext.GetCurrentUserEntityInfo(out _).Id;
return Result.Success().SetData(await _iUserService.GetUserAllInfo(userId));
var data = await _iUserService.GetUserAllInfo(userId);
data.Menus.Clear();
return Result.Success().SetData(data);
}
/// <summary>
/// 更新登录的用户密码
/// </summary>

View File

@@ -35,7 +35,6 @@ namespace Yi.Framework.ApiMicroservice.Controllers
}
/// <summary>
/// 得到树形菜单
/// </summary>

View File

@@ -30,9 +30,9 @@ namespace Yi.Framework.ApiMicroservice.Controllers
}
[HttpGet]
public async Task<Result> PageList()
public async Task<Result> PageList([FromQuery]UserEntity user, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iUserService._repository.GetListAsync());
return Result.Success().SetData(new PageModel(await _iUserService._repository.GetListAsync(),100) );
}
/// <summary>