public async Task <IActionResult> Detail(DetailModel detailModel) { if (detailModel.OrginDate != null) { detailModel.NoSearch = false; string reportdate = DateTimeToDateClass.DateStrToDateStr(detailModel.OrginDate); IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", Program.Websiteconfig.AliPayAppID, Program.Websiteconfig.AliPayPrivateKey, "json", "1.0", "RSA2", Program.Websiteconfig.AliPayPublicKey, "utf-8", false); var pageindex = 1; while (true) { AlipayUserInviteOfflinedetailQueryRequest request = new AlipayUserInviteOfflinedetailQueryRequest(); request.BizContent = "{" + "\"pid\":\"" + Program.Websiteconfig.Pid + "\"," + "\"report_date\":\"" + reportdate + "\"," + //"\"partner_id\":\"" + partner_id + "\"," + "\"page\":" + pageindex + "," + "\"page_size\":" + 500 + " }"; AlipayUserInviteOfflinedetailQueryResponse response = client.Execute(request); if (response.OfflineDetailInfoList != null) { detailModel.DataModelList.AddRange(response.OfflineDetailInfoList); detailModel.NoData = false; pageindex++; } else { break; } } } return(View(detailModel)); }
public async Task <IActionResult> Detail(int ActivityID, TaoBaoDetailModel detailModel) { var activity = await _context.ActivityModel.FirstOrDefaultAsync(i => i.ID == ActivityID); if (activity == null) { return(NotFound()); } var pageindex = 1; List <TbkDgNewuserOrderGetResponse.MapDataDomain> ItemList = new List <TbkDgNewuserOrderGetResponse.MapDataDomain>(); if (!detailModel.NoSearch) { detailModel.NoSearch = false; List <DateTime> times = DateTimeToDateClass.DateStrToDoubleDateTime(detailModel.FirstDate); while (true) { ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", Program.Websiteconfig.TaoBaoAppKey, Program.Websiteconfig.TaoBaoAppSecret, "json"); TbkDgNewuserOrderGetRequest req = new TbkDgNewuserOrderGetRequest(); req.PageSize = 100; //req.AdzoneId = 123L; req.PageNo = pageindex; req.StartTime = times[0]; req.EndTime = times[1]; req.ActivityId = activity.ActivityApiID; TbkDgNewuserOrderGetResponse rsp = client.Execute(req); if (rsp.Results.Data.Results == null) { detailModel.NoData = true; break; } ItemList.AddRange(rsp.Results.Data.Results); if (rsp.Results.Data.HasNext == false) { break; } pageindex++; } } detailModel.ActivityID = activity.ID; detailModel.ActivityName = activity.ActivityName; detailModel.DataModels = ItemList; detailModel.ActivityKindEnum = activity.ActivityKindEnum; return(View(detailModel)); }
public async Task <IActionResult> Sum(SumModel sumModel) { if (sumModel.OrginDate != null) //如果开始搜索 { List <AlipayOfflineSummaryModel> finalModelList = new List <AlipayOfflineSummaryModel>(); List <DateTime> times = DateTimeToDateClass.DateStrToDoubleDateTime(sumModel.OrginDate); DateTime dt1 = new DateTime(times[0].Year, times[0].Month, times[0].Day); DateTime dt2 = new DateTime(times[1].Year, times[1].Month, times[1].Day); IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", Program.Websiteconfig.AliPayAppID, Program.Websiteconfig.AliPayPrivateKey, "json", "1.0", "RSA2", Program.Websiteconfig.AliPayPublicKey, "utf-8", false); for (DateTime dt3 = dt1; dt3 <= dt2; dt3 = dt3.AddDays(1)) { AlipayUserInviteOfflinesummaryQueryRequest request = new AlipayUserInviteOfflinesummaryQueryRequest(); request.BizContent = "{" + "\"pid\":\"" + Program.Websiteconfig.Pid + "\"," + "\"report_date\":\"" + dt3.ToString("yyyyMMdd") + "\"" + //"\"partner_id\":\"m_qvdao1_qvdao2\"" + " }"; AlipayUserInviteOfflinesummaryQueryResponse response = client.Execute(request); if (response.OfflineInviteNewerSummaryInfoList != null) { foreach (var rspitem in response.OfflineInviteNewerSummaryInfoList) { if (sumModel.OrginPartnerid != null) { if (rspitem.PartnerId == sumModel.OrginPartnerid) { AlipayOfflineSummaryModel alipayOfflineSummaryModelitem = new AlipayOfflineSummaryModel() { ExtInfo = rspitem.ExtInfo, Pid = rspitem.Pid, ReportDate = rspitem.ReportDate, PartnerId = rspitem.PartnerId, }; finalModelList.Add(alipayOfflineSummaryModelitem); } else { continue; } } else { AlipayOfflineSummaryModel alipayOfflineSummaryModelitem = new AlipayOfflineSummaryModel() { ExtInfo = rspitem.ExtInfo, Pid = rspitem.Pid, ReportDate = rspitem.ReportDate, PartnerId = rspitem.PartnerId, }; finalModelList.Add(alipayOfflineSummaryModelitem); } } } } sumModel.DataModelList = finalModelList; sumModel.NoData = false; sumModel.NoSearch = false; } return(View(sumModel)); }