|
|
|
using DS.Module.Core;
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
using DS.WMS.Core.System.Dtos;
|
|
|
|
using DS.WMS.Core.System.Interface;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
namespace DS.WMS.MainApi.Controllers;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 公共模块
|
|
|
|
/// </summary>
|
|
|
|
public class CommonController : ApiController
|
|
|
|
{
|
|
|
|
private readonly ICommonService _invokeService;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 构造函数
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="invokeService"></param>
|
|
|
|
public CommonController(ICommonService invokeService)
|
|
|
|
{
|
|
|
|
_invokeService = invokeService;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 用户登录
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="model"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost]
|
|
|
|
[AllowAnonymous]
|
|
|
|
[Route("Login")]
|
|
|
|
public DataResult<string> Login([FromBody] UserLoginModel model)
|
|
|
|
{
|
|
|
|
var res = _invokeService.UserLogin(model);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取用户
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet]
|
|
|
|
[Route("GetUserInfo")]
|
|
|
|
public DataResult<CurrentUserViewModel> GetUserInfo()
|
|
|
|
{
|
|
|
|
var res = _invokeService.GetUserInfo();
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 登出
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost]
|
|
|
|
[Route("Logout")]
|
|
|
|
public DataResult<string> Logout()
|
|
|
|
{
|
|
|
|
return DataResult<string>.Success("");
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 查询用户拥有的菜单权限
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet]
|
|
|
|
[Route("GetUserPermissionByToken")]
|
|
|
|
public DataResult<List<RouteItem>> GetUserPermissionByToken()
|
|
|
|
{
|
|
|
|
var res = _invokeService.GetUserPermissionByToken();
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取服务器信息
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet]
|
|
|
|
[Route("GetServerInfo")]
|
|
|
|
public DataResult<dynamic> GetServerInfo()
|
|
|
|
{
|
|
|
|
var res = _invokeService.GetServerInfo();
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取角色下拉选项
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet]
|
|
|
|
[Route("GetRoleList")]
|
|
|
|
public DataResult<List<ApiSelectViewModel>> GetRoleList()
|
|
|
|
{
|
|
|
|
var res = _invokeService.GetRoleList();
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 修改密码
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="model"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost]
|
|
|
|
[Route("ChangePassword")]
|
|
|
|
public DataResult ChangePassword([FromBody] ChangePasswordReq model)
|
|
|
|
{
|
|
|
|
var res = _invokeService.ChangePassword(model);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 企业用户注册
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="model"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[AllowAnonymous]
|
|
|
|
[HttpPost]
|
|
|
|
[Route("TenantRegister")]
|
|
|
|
public DataResult TenantRegister([FromBody] TenantRegisterReq model)
|
|
|
|
{
|
|
|
|
var res = _invokeService.TenantRegister(model);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取数据权限字段
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="permissionId"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet]
|
|
|
|
[AllowAnonymous]
|
|
|
|
[Route("GetDataRuleEntityFields")]
|
|
|
|
public DataResult<List<EntityFieldProperty>> GetDataRuleEntityFields([FromQuery] string permissionId)
|
|
|
|
{
|
|
|
|
var res = _invokeService.GetDataRuleEntityFields(permissionId);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|