erp服务
This commit is contained in:
@@ -4,6 +4,9 @@ using System.Text;
|
|||||||
|
|
||||||
namespace WMS.Web.Core.Dto.Erp.Org
|
namespace WMS.Web.Core.Dto.Erp.Org
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 金蝶组织-基本信息
|
||||||
|
/// </summary>
|
||||||
public class ErpOrgDto
|
public class ErpOrgDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -11,6 +14,9 @@ namespace WMS.Web.Core.Dto.Erp.Org
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,22 +53,11 @@ namespace WMS.Web.Domain.Services.Public
|
|||||||
this._client = new ERPGWSoapClient(binding, address);
|
this._client = new ERPGWSoapClient(binding, address);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var appId = "wms";
|
var result = await this._client.ValidateSystemAsync(this._erpOptions.UserName, this._erpOptions.Password, this._erpOptions.ErpId, "");
|
||||||
var cache_key = "erp_accesstoken_"+ appId;
|
|
||||||
var cache_value = _memoryCache.Get<string>(cache_key);
|
|
||||||
if (!string.IsNullOrEmpty(cache_value))
|
|
||||||
return Result<string>.ReSuccess(cache_value);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var result = await this._client.ValidateSystemAsync(this._erpOptions.UserName, this._erpOptions.Password, this._erpOptions.ErpId, appId);
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
return Result<string>.ReFailure(ResultCodes.Erp_Login_Error);
|
return Result<string>.ReFailure(ResultCodes.Erp_Login_Error);
|
||||||
|
|
||||||
_memoryCache.Set(cache_key, true, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(30)));
|
|
||||||
return Result<string>.ReSuccess(result.AccessToken);
|
return Result<string>.ReSuccess(result.AccessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
return Result<string>.ReFailure(ResultCodes.Erp_Login_Error);
|
return Result<string>.ReFailure(ResultCodes.Erp_Login_Error);
|
||||||
|
|||||||
Reference in New Issue
Block a user