131 lines
3.6 KiB
C#
131 lines
3.6 KiB
C#
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection.Metadata;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Hg.Internal.Domain.Config
|
|
{
|
|
public class SystemConfig
|
|
{
|
|
public SystemConfig(string appid, string appSecret, string ssoUrl, string ssoOrganizationUrl, string[] clearCacheUrls, string userCenterRiaServiceUrl, string previewUrl, List<ClientKey>? clientKey)
|
|
{
|
|
Appid = appid;
|
|
AppSecret = appSecret;
|
|
SsoUrl = ssoUrl;
|
|
SsoOrganizationUrl = ssoOrganizationUrl;
|
|
ClearCacheUrls = clearCacheUrls;
|
|
UserCenterRiaServiceUrl = userCenterRiaServiceUrl;
|
|
PreviewUrl = previewUrl;
|
|
ClientKey = clientKey;
|
|
}
|
|
|
|
public SystemConfig()
|
|
{
|
|
|
|
}
|
|
|
|
public string Appid { get; set; }
|
|
|
|
public string AppSecret { get; set; }
|
|
|
|
public string SsoUrl { get; set; }
|
|
|
|
public string SsoOrganizationUrl { get; set; }
|
|
|
|
public string UserCenterRiaServiceUrl { get; set; }
|
|
|
|
public string PreviewUrl { get; set; }
|
|
|
|
public string AuditUrl { get; set; }
|
|
|
|
public string? Riskinfo { get; set; }
|
|
|
|
public string? ContractStatus { get; set; }
|
|
|
|
/// <summary>
|
|
/// 客户端密钥
|
|
/// </summary>
|
|
public List<ClientKey>? ClientKey { get; set; }
|
|
|
|
public List<Company> CompanyList { get; set; }
|
|
|
|
public string[] ClearCacheUrls { get; set; }
|
|
|
|
public string? ZxdUrl { get; set; }
|
|
public string? ZxdCoreUrl { get; set; }
|
|
|
|
public string? FileServer { get; set; }
|
|
|
|
public string? FileServerKey { get; set; }
|
|
|
|
public string GetAccessKey(string id)
|
|
{
|
|
return ClientKey?.First(x => x.Id == id).AccessKey ?? "";
|
|
}
|
|
|
|
public string GetRiskinfo()
|
|
{
|
|
return UserCenterRiaServiceUrl + Riskinfo;
|
|
}
|
|
|
|
public string PostContractStatus(string content, string sign, string clientId)
|
|
{
|
|
return $"{UserCenterRiaServiceUrl}{ContractStatus}?content={content}&sign={sign}&clientId={clientId}";
|
|
}
|
|
|
|
public string? GetCompanyVideoUrl(CompanyList company)
|
|
{
|
|
return CompanyList.Where(x => x.Code == company.GetDescription()).Select(x => x.VideoUrl).FirstOrDefault();
|
|
}
|
|
|
|
public string? GetCompanyWxMessageUrl(CompanyList company)
|
|
{
|
|
return CompanyList.Where(x => x.Code == company.GetDescription()).Select(x => x.WxMessageUrl).FirstOrDefault();
|
|
}
|
|
|
|
public string? GetCompanyName(CompanyList company)
|
|
{
|
|
return CompanyList.Where(x => x.Code == company.GetDescription()).Select(x => x.Name).FirstOrDefault();
|
|
}
|
|
|
|
public string? GetCompanyCode(CompanyList company)
|
|
{
|
|
return CompanyList.Where(x => x.Code == company.GetDescription()).Select(x => x.Code).FirstOrDefault();
|
|
}
|
|
|
|
public string UploadFileServer()
|
|
{
|
|
return $"{FileServer}/File/upload";
|
|
|
|
}
|
|
|
|
public string GetFileServerToken()
|
|
{
|
|
return $"{FileServer}/api/Token?key={FileServerKey}";
|
|
}
|
|
}
|
|
|
|
public class ClientKey
|
|
{
|
|
public string Id { get; set; }
|
|
|
|
public string Name { get; set; }
|
|
|
|
public string AccessKey { get; set; }
|
|
}
|
|
|
|
public class Company
|
|
{
|
|
public string? Code { get; set; }
|
|
|
|
public string? Name { get; set; }
|
|
|
|
public string? VideoUrl { get; set; }
|
|
|
|
public string? WxMessageUrl { get; set; }
|
|
}
|
|
}
|