This commit is contained in:
2023-11-23 14:41:06 +08:00
parent 23ab9fa523
commit 6840cfcbb1
4 changed files with 49 additions and 10 deletions

View File

@@ -161,4 +161,9 @@ public interface IUserManager
/// 获取管理员用户id.
/// </summary>
string GetAdminUserId();
/// <summary>
/// 域名
/// </summary>
string Domain{ get; }
}

View File

@@ -6,5 +6,36 @@
public partial class UserManager
{
public static string AsscessToken { get; set; }
public string Domain
{
get
{
try
{
string host = "";
if (App.HttpContext != null)
{
host = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
}
else
{
var datatable = _repository.AsSugarClient().Ado
.GetDataTable("select * from bas_factory_config where key='domain' limit 1");
if (datatable.Rows.Count > 0)
{
host = datatable.Rows[0]["value"].ToString();
Console.WriteLine(host);
}
}
return host;
}
catch (Exception e)
{
return "http://tnb.tuotong-tech.com";
}
}
}
}