Browse Source

青藏

bjmzak
DESKTOP-G961P6V\Zhh 1 year ago
parent
commit
0a78476bc6
  1. 27
      src/Shentun.ColumnReferencePlugIns/PlugInsBase.cs

27
src/Shentun.ColumnReferencePlugIns/PlugInsBase.cs

@ -27,8 +27,8 @@ namespace Shentun.Peis.PlugIns
protected string? AppConnctionStr;
private string? _appBaseAddress;
private static string? _accesToken;
protected string? SelfUser;
protected string? SelfPassword;
protected string? AppUser;
protected string? AppPassword;
protected string? InterfaceSql;
protected string? InterfaceSqlKeyColumn;
@ -68,9 +68,9 @@ namespace Shentun.Peis.PlugIns
.GetSection("Default").Value;
_appBaseAddress = AppConfig.GetSection("App")
.GetSection("SelfUrl").Value;
SelfUser = AppConfig.GetSection("App")
AppUser = AppConfig.GetSection("App")
.GetSection("SelfUser").Value;
SelfPassword = AppConfig.GetSection("App")
AppPassword = AppConfig.GetSection("App")
.GetSection("SelfPassword").Value;
using var loggerFactory = LoggerFactory.Create(builder =>
@ -84,7 +84,18 @@ namespace Shentun.Peis.PlugIns
var configurationBuilder = new ConfigurationBuilder()
.AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue)));
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;
InterfaceSqlKeyColumn = InterfaceConfig.GetSection("Interface").GetSection("SqlKeyColumn").Value;
InterfaceDbType = InterfaceConfig.GetSection("Interface").GetSection("DbType").Value;
@ -218,15 +229,15 @@ namespace Shentun.Peis.PlugIns
public async virtual Task<WebApiOutDto<LoginOutDataDto>> LoginAsync()
{
if(string.IsNullOrWhiteSpace(SelfUser))
if(string.IsNullOrWhiteSpace(AppUser))
{
throw new Exception("SelfUser不能为空");
}
if (string.IsNullOrWhiteSpace(SelfPassword))
if (string.IsNullOrWhiteSpace(AppPassword))
{
throw new Exception("SelfPassword不能为空");
}
var relult = await LoginAsync(SelfUser, SelfPassword);
var relult = await LoginAsync(AppUser, AppPassword);
return relult;
}
public async Task<WebApiOutDto<LoginOutDataDto>> LoginAsync(string userId, string password)

Loading…
Cancel
Save