|
|
@ -27,8 +27,8 @@ namespace Shentun.Peis.PlugIns |
|
|
protected string? AppConnctionStr; |
|
|
protected string? AppConnctionStr; |
|
|
private string? _appBaseAddress; |
|
|
private string? _appBaseAddress; |
|
|
private static string? _accesToken; |
|
|
private static string? _accesToken; |
|
|
protected string? SelfUser; |
|
|
|
|
|
protected string? SelfPassword; |
|
|
|
|
|
|
|
|
protected string? AppUser; |
|
|
|
|
|
protected string? AppPassword; |
|
|
|
|
|
|
|
|
protected string? InterfaceSql; |
|
|
protected string? InterfaceSql; |
|
|
protected string? InterfaceSqlKeyColumn; |
|
|
protected string? InterfaceSqlKeyColumn; |
|
|
@ -68,9 +68,9 @@ namespace Shentun.Peis.PlugIns |
|
|
.GetSection("Default").Value; |
|
|
.GetSection("Default").Value; |
|
|
_appBaseAddress = AppConfig.GetSection("App") |
|
|
_appBaseAddress = AppConfig.GetSection("App") |
|
|
.GetSection("SelfUrl").Value; |
|
|
.GetSection("SelfUrl").Value; |
|
|
SelfUser = AppConfig.GetSection("App") |
|
|
|
|
|
|
|
|
AppUser = AppConfig.GetSection("App") |
|
|
.GetSection("SelfUser").Value; |
|
|
.GetSection("SelfUser").Value; |
|
|
SelfPassword = AppConfig.GetSection("App") |
|
|
|
|
|
|
|
|
AppPassword = AppConfig.GetSection("App") |
|
|
.GetSection("SelfPassword").Value; |
|
|
.GetSection("SelfPassword").Value; |
|
|
|
|
|
|
|
|
using var loggerFactory = LoggerFactory.Create(builder => |
|
|
using var loggerFactory = LoggerFactory.Create(builder => |
|
|
@ -84,7 +84,18 @@ namespace Shentun.Peis.PlugIns |
|
|
var configurationBuilder = new ConfigurationBuilder() |
|
|
var configurationBuilder = new ConfigurationBuilder() |
|
|
.AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue))); |
|
|
.AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue))); |
|
|
InterfaceConfig = configurationBuilder.Build(); |
|
|
InterfaceConfig = configurationBuilder.Build(); |
|
|
|
|
|
|
|
|
|
|
|
//如果接口配置里面配置了用户名密码,则用接口中的覆盖本地配置
|
|
|
|
|
|
var appUser = InterfaceConfig.GetSection("App").GetSection("User").Value; |
|
|
|
|
|
if(!string.IsNullOrWhiteSpace(appUser)) |
|
|
|
|
|
{ |
|
|
|
|
|
AppUser = appUser; |
|
|
|
|
|
} |
|
|
|
|
|
var appPassword = InterfaceConfig.GetSection("App").GetSection("Password").Value; |
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(appPassword)) |
|
|
|
|
|
{ |
|
|
|
|
|
AppPassword = appPassword; |
|
|
|
|
|
} |
|
|
|
|
|
//设置接口有关配置
|
|
|
InterfaceSql = InterfaceConfig.GetSection("Interface").GetSection("Sql").Value; |
|
|
InterfaceSql = InterfaceConfig.GetSection("Interface").GetSection("Sql").Value; |
|
|
InterfaceSqlKeyColumn = InterfaceConfig.GetSection("Interface").GetSection("SqlKeyColumn").Value; |
|
|
InterfaceSqlKeyColumn = InterfaceConfig.GetSection("Interface").GetSection("SqlKeyColumn").Value; |
|
|
InterfaceDbType = InterfaceConfig.GetSection("Interface").GetSection("DbType").Value; |
|
|
InterfaceDbType = InterfaceConfig.GetSection("Interface").GetSection("DbType").Value; |
|
|
@ -218,15 +229,15 @@ namespace Shentun.Peis.PlugIns |
|
|
|
|
|
|
|
|
public async virtual Task<WebApiOutDto<LoginOutDataDto>> LoginAsync() |
|
|
public async virtual Task<WebApiOutDto<LoginOutDataDto>> LoginAsync() |
|
|
{ |
|
|
{ |
|
|
if(string.IsNullOrWhiteSpace(SelfUser)) |
|
|
|
|
|
|
|
|
if(string.IsNullOrWhiteSpace(AppUser)) |
|
|
{ |
|
|
{ |
|
|
throw new Exception("SelfUser不能为空"); |
|
|
throw new Exception("SelfUser不能为空"); |
|
|
} |
|
|
} |
|
|
if (string.IsNullOrWhiteSpace(SelfPassword)) |
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(AppPassword)) |
|
|
{ |
|
|
{ |
|
|
throw new Exception("SelfPassword不能为空"); |
|
|
throw new Exception("SelfPassword不能为空"); |
|
|
} |
|
|
} |
|
|
var relult = await LoginAsync(SelfUser, SelfPassword); |
|
|
|
|
|
|
|
|
var relult = await LoginAsync(AppUser, AppPassword); |
|
|
return relult; |
|
|
return relult; |
|
|
} |
|
|
} |
|
|
public async Task<WebApiOutDto<LoginOutDataDto>> LoginAsync(string userId, string password) |
|
|
public async Task<WebApiOutDto<LoginOutDataDto>> LoginAsync(string userId, string password) |
|
|
|