You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
164 lines
4.1 KiB
C#
164 lines
4.1 KiB
C#
using DS.Module.Core;
|
|
using DS.WMS.Core.System.Dtos;
|
|
using DS.WMS.Core.System.Entity;
|
|
using DS.WMS.Core.System.Interface;
|
|
using FluentValidation.AspNetCore;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace DS.WMS.WebApi.Controllers;
|
|
|
|
/// <summary>
|
|
/// 用户模块
|
|
/// </summary>
|
|
public class UserController : ApiController
|
|
{
|
|
private readonly IUserService _invokeService;
|
|
/// <summary>
|
|
/// 构造函数
|
|
/// </summary>
|
|
/// <param name="invokeService"></param>
|
|
public UserController(IUserService invokeService)
|
|
{
|
|
_invokeService = invokeService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 用户登录
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[AllowAnonymous]
|
|
[Route("Login")]
|
|
public DataResult<CurrentUserViewModel> Login([FromBody] UserLoginModel model)
|
|
{
|
|
var res = _invokeService.UserLogin(model);
|
|
return res;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取用户
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[Route("GetUserInfo")]
|
|
public DataResult<CurrentUserViewModel> GetUserInfo([FromQuery]string id)
|
|
{
|
|
var res = _invokeService.GetUserInfo(id);
|
|
return res;
|
|
}
|
|
/// <summary>
|
|
/// 登出
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[Route("Logout")]
|
|
public DataResult<string> Logout()
|
|
{
|
|
return DataResult<string>.Success("");
|
|
}
|
|
/// <summary>
|
|
/// 用户列表
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[Route("GetUserList")]
|
|
public DataResult<List<tb_User>> GetUserList([FromBody] PageRequest request)
|
|
{
|
|
var res = _invokeService.GetListByPage(request);
|
|
return res;
|
|
}
|
|
/// <summary>
|
|
/// 获取用户权限菜单
|
|
/// </summary>
|
|
/// <param name="userId"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[Route("GetUserPermission")]
|
|
public DataResult<Permission> GetUserPermission([FromQuery]string userId)
|
|
{
|
|
var res = _invokeService.GetUserPermission(userId);
|
|
return res;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取用户菜单
|
|
/// </summary>
|
|
/// <param name="userId"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[Route("GetUserMenuList")]
|
|
public DataResult<List<UserMenu>> GetUserMenuList([FromQuery]string userId)
|
|
{
|
|
var res = _invokeService.GetUserMenuList(userId);
|
|
return res;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取用户信息
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[Route("GetUserItem")]
|
|
public DataResult<UserViewModel> GetUserItem([FromQuery]string id)
|
|
{
|
|
var res = _invokeService.GetUserItem(id);
|
|
return res;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编辑
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[Route("EditUser")]
|
|
public DataResult EditUser([FromBody] UserInput model)
|
|
{
|
|
var res = _invokeService.EditUser(model);
|
|
return res;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 审核
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[Route("AuditUser")]
|
|
public DataResult AuditUser([FromBody] UserInput model)
|
|
{
|
|
var res = _invokeService.AuditUser(model);
|
|
return res;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 版本升级
|
|
/// </summary>
|
|
/// <param name="appVersion">版本号</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[Route("AppUpdate")]
|
|
public JsonResult AppUpdate([FromQuery] string appVersion)
|
|
{
|
|
var res = _invokeService.AppUpdate(appVersion);
|
|
return Json(res);
|
|
}
|
|
/// <summary>
|
|
/// 查询用户拥有的菜单权限和按钮权限
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[Route("GetUserPermissionByToken")]
|
|
public DataResult<List<RouteItem>> GetUserPermissionByToken([FromQuery]string id)
|
|
{
|
|
var res = _invokeService.GetUserPermissionByToken(id);
|
|
return res;
|
|
}
|
|
} |