Initial ...
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using xCommons.Attributes;
|
||||
using xCommons.Extensions;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xApi.Controllers
|
||||
{
|
||||
public partial class AccountController
|
||||
{
|
||||
#region Open Actions ...
|
||||
[AllowAnonymous]
|
||||
[RequireXPowered]
|
||||
[HttpGet("GetUserInfo")]
|
||||
public async Task<ActionResult<string>> GetUserInfo(
|
||||
[FromHeader] string token,
|
||||
[FromQuery] string request
|
||||
)
|
||||
{
|
||||
//
|
||||
// Do Action ...
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotEmpty(token)
|
||||
.AddNotEmpty(request)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var result = await identityProvider.GetUserInfo(
|
||||
token: token,
|
||||
request: request
|
||||
);
|
||||
|
||||
//
|
||||
// Return Result
|
||||
return Ok(result
|
||||
.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[RequireXPowered]
|
||||
[HttpGet("GetUserInfoByDevice")]
|
||||
public async Task<ActionResult<string>> GetUserInfoByDevice(
|
||||
[FromQuery] string userSelectByParam,
|
||||
[FromBody] XDeviceDto device
|
||||
)
|
||||
{
|
||||
//
|
||||
// Do Action ...
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
await ValidationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotEmpty(userSelectByParam)
|
||||
.AddNotNull(device)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var result = await identityProvider.GetUserInfo(
|
||||
userSelectByParam: userSelectByParam,
|
||||
device: device
|
||||
);
|
||||
|
||||
//
|
||||
// Return Result
|
||||
return Ok(result
|
||||
.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user