Commit f60d6fb2 by lizefeng

fix

parent 13b563a9
...@@ -12,6 +12,7 @@ using System.Text.RegularExpressions; ...@@ -12,6 +12,7 @@ using System.Text.RegularExpressions;
using AutoTurnOver.Models.Base; using AutoTurnOver.Models.Base;
using System.Threading.Tasks; using System.Threading.Tasks;
using AutoTurnOver.Models.ApiDto.Stock; using AutoTurnOver.Models.ApiDto.Stock;
using System.Threading;
namespace AutoTurnOver.Services namespace AutoTurnOver.Services
{ {
...@@ -262,20 +263,38 @@ namespace AutoTurnOver.Services ...@@ -262,20 +263,38 @@ namespace AutoTurnOver.Services
/// 获取亚马逊账号 /// 获取亚马逊账号
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static List<AmazonAccountDto> GetAmazonAccountList() public static List<AmazonAccountDto> GetAmazonAccountList(int count = 0)
{ {
string url = ConfigHelper.GetValue("Pams_GetAccountToken"); try
string resultStr = HttpHelper.Request(url, RequestType.GET, "", timeout: 1000 * 60 * 60 * 24);
var result = resultStr.ToObj<PamsResultDto<List<AmazonAccountDto>>>();
if (result == null)
{ {
throw new Exception("账号系统异常: 未获取到数据"); string url = ConfigHelper.GetValue("Pams_GetAccountToken");
string resultStr = HttpHelper.Request(url, RequestType.GET, "", timeout: 1000 * 60 * 60 * 24);
var result = resultStr.ToObj<PamsResultDto<List<AmazonAccountDto>>>();
if (result == null)
{
throw new Exception("账号系统异常: 未获取到数据");
}
if (!result.Success)
{
throw new Exception("账号系统异常: " + result.Message);
}
return result.Data;
} }
if (!result.Success) catch (Exception ex)
{ {
throw new Exception("账号系统异常: " + result.Message); if (count < 20)
{
Thread.Sleep(10 * 1000);
count++;
return GetAmazonAccountList(count);
}
else
{
throw;
}
} }
return result.Data;
} }
public static List<AccountDto> AccountList(string name) public static List<AccountDto> AccountList(string name)
......
...@@ -57,7 +57,7 @@ namespace ResetOutofstock ...@@ -57,7 +57,7 @@ namespace ResetOutofstock
//new AmazonDataSynchroService().SynchroReportIds(FikaAmazonAPI.Utils.Constants.ReportTypes.GET_V2_SETTLEMENT_REPORT_DATA_FLAT_FILE_V2, 10); //new AmazonDataSynchroService().SynchroReportIds(FikaAmazonAPI.Utils.Constants.ReportTypes.GET_V2_SETTLEMENT_REPORT_DATA_FLAT_FILE_V2, 10);
//while (true) //while (true)
//{ //{
// new AmazonDataSynchroService().AnaReport(); // new AmazonDataSynchroService().AnaReport(-1);
//} //}
} }
catch (Exception ex) catch (Exception ex)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment