public override void CheckedData(SynCheckedDataInfoEntity entity, SynDataInfoEntity item) { BaiduV2AccountService serviceAccount = new BaiduV2AccountService(item.AccountName, CryptHelper.DESDecode(item.AccountPwd), CryptHelper.DESDecode(item.Token)); while (string.IsNullOrEmpty(entity.FilePath)) { Thread.Sleep(1000); if (serviceAccount.HasFileOnServer(item.DealWithId)) { List<FilePathInfo> alls = new List<FilePathInfo>(); while (!alls.Any()) { alls = serviceAccount.GetAllObjectsPath(item.DealWithId); } if (alls.Any()) { foreach (var url in alls) { entity.FilePath = url.FilePath; entity.FileName = url.FileName; // 记录获取下载链接的时间,精确到小时 entity.DealWithDate = DateTime.Now; // 直接下载 base.DownloadFileAndSynData(entity); DataHelper.AppendSynCheckedDataInfo(entity); } DataHelper.RemoveSynDataInfo(item); } } } serviceAccount = null; }
/// <summary> /// 请求处理编号 /// </summary> public void GetDealWithId(DateTime dt, SynDataInfoEntity entity) { BaiduV2AccountService serviceAccount = new BaiduV2AccountService(entity.AccountName, CryptHelper.DESDecode(entity.AccountPwd), CryptHelper.DESDecode(entity.Token)); string dealId = string.Empty; // 轮询接口,直到有ID返回 while (string.IsNullOrEmpty(dealId)) { dealId = RequestDealWithId(serviceAccount, dt); Thread.Sleep(500); } if (string.IsNullOrEmpty(dealId) == false) { entity.DealWithId = dealId; DataHelper.AppendSynDataInfo(entity); RequestReport(dt, entity); } }
/// <summary> /// 请求的处理ID /// </summary> protected virtual string RequestDealWithId(BaiduV2AccountService serviceAccount, DateTime dt) { return(string.Empty); }
protected override string RequestDealWithId(BaiduV2AccountService serviceAccount, DateTime dt) { return serviceAccount.GetAllObjects(); }