1.修复多账套对接时报工切换账套不生效(严重bug)

2.切换底层逻辑,增加外部增加数据源的接口
3.增加缓存,减少频繁登录导致可能存在的突发数据库连接异常
This commit is contained in:
minjQiu
2024-07-14 18:01:02 +08:00
parent 71e2904de7
commit ad475d4ffe
24 changed files with 1161 additions and 105 deletions
@@ -19,7 +19,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
private NetLogin _netLogin { get; set; }
private VBLogin _vbLogin { get; set; }
private ProductContext _productContext { get; set; }
public ProductContext _productContext { get; set; }
public Connection Connection { get; set; }
@@ -83,49 +83,12 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
Trace.WriteLine($"3--登录令牌:{_vbLogin.userToken}");
//Trace.WriteLine($"4--正在创建应用池:{_netLogin.userToken}");
//var info = U8LoginInfo.CreateInstance(_netLogin.userToken);
//U8LoginInfoPool.Add(_netLogin.userToken, info);
//Trace.WriteLine($"4--创建应用池:{info.U8LoginToken}");
//Trace.WriteLine($"4--正在设置线程登录信息:{_netLogin.userToken}");
//ThreadContext.SetLoginInfo(_netLogin.userToken);
//Trace.WriteLine($"4--设置线程登录信息:{_netLogin.userToken}");
Trace.WriteLine($"4--正在创建应用池:{_netLogin.userToken}");
return;
}
//if (_vbLogin ==null)
//{
// _vbLogin = new VBLogin();
// _vbLogin.ClearError();
// if (!_vbLogin.Login(paramter.pSubId, paramter.pAccId, paramter.pYearId, paramter.pUserId, paramter.pPassword, paramter.pDate, paramter.cSrv, paramter.cSerial) && string.IsNullOrWhiteSpace(_vbLogin.userToken))
// {
// //_vbLogin.ShutDown();
// throw new Exception(_vbLogin.ShareString);
// }
// Trace.WriteLine($"U8版本:{_vbLogin.GetVersionInfo()}");
// Trace.WriteLine($"1--登录令牌:{_netLogin.userToken}");
// if (!string.IsNullOrWhiteSpace(Cryptography.m_userToken))
// {
// Cryptography.m_userToken = "";
// }
//}
//if (!string.IsNullOrWhiteSpace(Cryptography.m_userToken))
//{
// Cryptography.m_userToken = "";
//}
_productContext = _netLogin.Login("AS", _vbLogin.userToken);
Trace.WriteLine($"3--上下文令牌:{_productContext.calledContext.token}");
@@ -133,25 +96,33 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
if (_productContext == null)
throw new Exception($"2--初始化U8登录上下文失败------{_netLogin.ErrDescript}");
ClientUserContext.Instance.RefreshContext();
Connection = new Connection();
Connection.Open(_vbLogin.UfDbName);
}
public void ShutDown()
{
U8LoginInfoPool.Clear();
U8LoginInfoPool.Remove(_netLogin.userToken);
_vbLogin.ShutDown();
_netLogin.ShutDown();
_netLogin.Dispose();
ThreadContext.ServerToken = null;
_vbLogin?.ShutDown();
_productContext=null;
_netLogin?.ShutDown();
_netLogin?.Dispose();
_vbLogin = null;
_netLogin = null;
if (!string.IsNullOrWhiteSpace(Cryptography.m_userToken))
{
Cryptography.m_userToken = "";
}
}
public bool CheckAccId(string cAccId)
{
return _vbLogin.get_cAcc_Id() == cAccId;
}
}
}