2024-07-17 02:32:45 +00:00
|
|
|
|
using DeviceRepair.Models;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using TsSFCDeivceClient.Model;
|
2024-05-29 01:56:37 +00:00
|
|
|
|
|
|
|
|
|
namespace TsSFCDeivceClient
|
|
|
|
|
{
|
|
|
|
|
public static class Runtime
|
|
|
|
|
{
|
|
|
|
|
public static string inParams;
|
|
|
|
|
|
2024-07-17 02:32:45 +00:00
|
|
|
|
public static UserInfo _CurrentUser;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// TsSFC用户信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static UserInfo CurrentUser
|
|
|
|
|
{
|
|
|
|
|
get { return _CurrentUser; }
|
|
|
|
|
set { _UserAuths = null; _CurrentUser = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static List<string> _UserAuths;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// TsSFC用户权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static List<string> UserAuths
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_UserAuths == null)
|
|
|
|
|
{
|
|
|
|
|
if (CurrentUser != null || CurrentUser.GUID != Guid.Empty)
|
|
|
|
|
{
|
|
|
|
|
APIResponseData apiResponseData = Biz.CommonApi.Instance.GetTsSFCUserAuths(CurrentUser.GUID);
|
|
|
|
|
if (!apiResponseData.IsSuccess)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(apiResponseData.Message);
|
|
|
|
|
}
|
|
|
|
|
_UserAuths = apiResponseData.ToDeserializeObject<List<string>>();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_UserAuths = new List<string>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return _UserAuths;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否包含指定权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="AuthCode"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static bool UserHasAuth(string AuthCode)
|
|
|
|
|
{
|
|
|
|
|
return UserAuths.Any(x => x.Contains(AuthCode));
|
|
|
|
|
}
|
2024-05-29 01:56:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|