You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
using Elight.Entity;
|
|
|
|
using Elight.Utility.Extensions;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IdentityModel.Tokens.Jwt;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Security.Claims;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
namespace Elight.Utility
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// 用户信息
|
|
|
|
/// </summary>
|
|
|
|
/// Author:mxg
|
|
|
|
/// CreatedTimed:2022-05-15 10:08 PM
|
|
|
|
public class User
|
|
|
|
{
|
|
|
|
#region Identity
|
|
|
|
|
|
|
|
private readonly IHttpContextAccessor _accessor;
|
|
|
|
|
|
|
|
public User(IHttpContextAccessor accessor)
|
|
|
|
{
|
|
|
|
_accessor = accessor;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion Identity
|
|
|
|
|
|
|
|
|
|
|
|
public App_Sys_UserModel Userdata()
|
|
|
|
{
|
|
|
|
var data = _accessor?.HttpContext?.User?.FindFirst(ClaimTypes.UserData);
|
|
|
|
if (data!=null)
|
|
|
|
{
|
|
|
|
var da = JsonConvert.DeserializeObject<App_Sys_UserModel>(data.Value);
|
|
|
|
return da;
|
|
|
|
}else
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|