/// <summary> /// 获取流水 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void button1_Click(object sender, EventArgs e) { WebResponseBase webResponseBase = await BankGatewayService.GetInformation(this.txb_userId.Text.Trim()); string urlText = "http://web.hkmdev.firstpay.com/phoenixFS-web/manage/showAccountQuery?reqId=web.p2p.member.info.manage-54df397e-39d0-4180-b3de-5972b4159ec4"; if (webResponseBase != null) { string url = $"http://fsgw.hkmdev.firstpay.com/phoenixFS-fsgw/gateway?data={HttpUtility.UrlEncode(webResponseBase.Data)}&tm={HttpUtility.UrlEncode(webResponseBase.Tm)}&merchantId={webResponseBase.MerchantId}"; //获取跳转后的数据 WebClient webClient = new WebClient(); byte[] htmlBytes = webClient.DownloadData(new Uri(urlText)); string c = Encoding.UTF8.GetString(htmlBytes); } MessageBox.Show("获取网关异常"); }
private void btn_HandleThings_Click(object sender, EventArgs e) { try { List <string> userIds = this.txb_handleUserIds.Text.Trim().Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList(); if (userIds.Count == 0) { MessageBox.Show("请输入userIds....."); return; } this.lbl_showmsg.Text = "正在准备数据......"; this.btn_HandleThings.Enabled = false; List <AssetDebtRebatesModel> listDebtRebateModels = this.GetDebtRebatesInfos(userIds); if (userIds.Count == 0) { this.lbl_showmsg.Text = "提示"; this.btn_HandleThings.Enabled = true; return; } this.txb_UserNums.Text = userIds.Count.ToString(); //对listCancelBookModles分组 //获取集合 List <Task> tasks = new List <Task>(); for (int i = 0; i < 6; i++) { tasks.Add(Task.Run(async() => { while (userIds.Count > 0) { string userId = string.Empty; lock (this.objLock) { if (userIds.Count > 0) { userId = userIds[0]; if (!string.IsNullOrEmpty(userId)) { userIds.Remove(userId); } } } if (!string.IsNullOrEmpty(userId)) { List <AssetDebtRebatesModel> modelsByUserId = listDebtRebateModels.Where(x => x.UserId == userId).ToList(); if (modelsByUserId.Count == 0) { continue; } long totalAmount = 0; bool isFlag = false; foreach (AssetDebtRebatesModel item in modelsByUserId) { //执行 SubOrder firstOrDefault = item.subOrderListArray.FirstOrDefault(); if (firstOrDefault != null) { string orderId = firstOrDefault.SubOrderId; //查询银行 int status = await BankGatewayService.GetOrderSearch(orderId); for (int j = 0; j < 5; j++) { status = await BankGatewayService.GetOrderSearch(orderId); if (status == 1) { break; } } switch (status) { case 1: //获取金额 totalAmount += firstOrDefault.Amount; break; case -2: isFlag = true; //记录用户Id和orderid重试几次 Logger.LoadData(@"GetDebtRebateData\ErrorId.txt", $"UserId:{userId},OrderId{orderId}"); break; } } } //输入总流水 int data = isFlag ? 0 : 1; string userData = $"{userId},{totalAmount},{data}"; Logger.LoadData(@"GetDebtRebateData\UserInfo.txt", userData); lock (this.objLock) { this.txb_SuccessNums.Text = (Convert.ToInt32(this.txb_SuccessNums.Text) + 1).ToString(); } } } })); } Task.WaitAll(tasks.ToArray()); //执行完毕后 this.lbl_showmsg.Text = "全部执行完毕"; this.btn_HandleThings.Enabled = true; } catch (Exception exception) { Console.WriteLine(exception); throw; } }
private async void button1_Click(object sender, EventArgs e) { //LocalDb //开始申购 //1.获取所有的用户 充值了的 //10000*(1000) try { Random random = new Random(); DataTable dt = SqlHelper.SqlHelper.ExecuteDataTable("select * from AccountUsers where IsVerifed=1 and IsActivity=1 and RechargeAmount>0"); int nums = random.Next(1, 6); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; string userId = dr["UserIdentifier"].ToString(); //授权 while (nums > 0) { int num = random.Next(1, 1001); //预约批量投资 long frezzeAmount = num * 10000; string orderId = Guid.NewGuid().ToGuidString(); BookFrezzeModel bookFrezzeModel = new BookFrezzeModel { FreezeAccountAmount = frezzeAmount, FreezeSumAmount = frezzeAmount, FreezeType = "01", OrderId = orderId, Remark = "", ReturnUrl = "http://www.baidu.com", RpOrderList = null, UserId = userId }; //预约冻结 bool result = await BankGatewayService.BooKFreeze(bookFrezzeModel); if (result) { //购买 BookInvestingModel bookInvestingModel = new BookInvestingModel { Cellphone = dr["CellPhone"].ToString(), CredentialNo = dr["CredentialNo"].ToString(), CredentialType = "10", OrderId = orderId, PurchaseAmount = frezzeAmount, PurchaseStartDateTime = DateTime.Now.ToChinaStandardTime(), RealName = dr["RealName"].ToString(), UserId = userId }; //调用接口 bool result1 = await YemApiService.Booking(ConfigurationManager.AppSettings["yemApiUrl"], bookInvestingModel); } nums -= 1; } nums = random.Next(1, 6); } } catch (Exception exception) { Console.WriteLine(exception); throw; } }