private void weipaySend_Click(object sender, EventArgs e) { int serialid = Globals.ToNum(this.HiddenSid.Value); decimal num2 = decimal.Parse(this.hdreferralblance.Value); MemberAmountRequestInfo amountRequestDetail = MemberAmountProcessor.GetAmountRequestDetail(serialid); if (amountRequestDetail != null) { if (amountRequestDetail.State == RequesState.已发放) { this.ShowMsg("该申请已经支付,请检查", false); } else if (amountRequestDetail.State == RequesState.驳回) { this.ShowMsg("该申请已经驳回,请检查", false); } else if (string.IsNullOrEmpty(amountRequestDetail.RedpackId)) { this.ShowMsg("商户订单ID为空,请重试!", false); } else { WeiPayResult result = OutPayHelp.SingleWeiPay((int)(num2 * 100M), "用户余额发放!", amountRequestDetail.AccountCode, amountRequestDetail.AccountName, amountRequestDetail.RedpackId, amountRequestDetail.UserId); if (result.result_code == "SUCCESS") { int[] serialids = new int[] { serialid }; MemberAmountProcessor.SetAmountRequestStatus(serialids, 2, "微信企业付款", "", ManagerHelper.GetCurrentManager().UserName); int userId = amountRequestDetail.UserId; string url = Globals.FullPath("/Vshop/MemberAmountRequestDetail.aspx?Id=" + amountRequestDetail.Id); try { Messenger.SendWeiXinMsg_MemberAmountDrawCashRelease(amountRequestDetail, url); } catch { } this.LoadParameters(); this.BindData(); this.ShowMsg("支付成功!", true); } else { if (((result.err_code == "OPENID_ERROR") || (result.err_code == "NAME_MISMATCH")) || (result.return_msg.Contains("openid字段") || (result.err_code == "FATAL_ERROR"))) { MemberAmountProcessor.SetAmountRequestStatus(new int[] { serialid }, 3, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + result.return_msg, num2.ToString(), ManagerHelper.GetCurrentManager().UserName); this.LoadParameters(); this.BindData(); } else { MemberAmountProcessor.SetAmountRequestStatus(new int[] { serialid }, 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + result.return_msg, num2.ToString(), ManagerHelper.GetCurrentManager().UserName); } this.ShowMsg("微信企业付款失败," + result.return_msg, false); } } } else { this.ShowMsg("参数错误!", false); } }
private void BatchPaySend_Click(object sender, EventArgs e) { this.GetPaySetting(); string str = ""; if (!string.IsNullOrEmpty(base.Request["CheckBoxGroup"])) { str = base.Request["CheckBoxGroup"]; } else { this.ShowMsg("参数错误!", false); return; } string str2 = this.PaybatchType.Value; if (str2 == "0") { string[] strArray = str.Split(new char[] { ',' }); List <OutPayWeiInfo> batchUserList = new List <OutPayWeiInfo>(); foreach (string str3 in strArray) { MemberAmountRequestInfo amountRequestDetail = MemberAmountProcessor.GetAmountRequestDetail(int.Parse(str3)); if (((amountRequestDetail != null) && (amountRequestDetail.State == RequesState.已审核)) && (this.DrawMinNum <= amountRequestDetail.Amount)) { OutPayWeiInfo item = new OutPayWeiInfo { Amount = ((int)amountRequestDetail.Amount) * 100, Partner_Trade_No = amountRequestDetail.RedpackId, Openid = amountRequestDetail.AccountCode, Re_User_Name = amountRequestDetail.AccountName, Desc = " 用户余额发放", UserId = amountRequestDetail.UserId, Nonce_Str = OutPayHelp.GetRandomString(20), Sid = amountRequestDetail.Id }; batchUserList.Add(item); } } if (batchUserList.Count < 1) { this.ShowMsg("没有满足条件的提现请求!", false); this.LoadParameters(); this.BindData(); } else { List <WeiPayResult> list2 = OutPayHelp.BatchWeiPay(batchUserList); if (list2.Count < 1) { this.ShowMsg("系统异常,请联系管理员!", false); } else if (list2[0].return_code == "INITFAIL") { this.ShowMsg(list2[0].return_msg, false); } else { int num = 0; int num2 = 0; int num3 = 0; int count = batchUserList.Count; string str4 = "<div class='errRow'>支付失败信息如下:"; using (List <WeiPayResult> .Enumerator enumerator = list2.GetEnumerator()) { while (enumerator.MoveNext()) { Func <OutPayWeiInfo, bool> predicate = null; WeiPayResult rItem = enumerator.Current; if (predicate == null) { predicate = t => t.Partner_Trade_No == rItem.partner_trade_no; } int sid = batchUserList.FirstOrDefault <OutPayWeiInfo>(predicate).Sid; if (rItem.result_code == "SUCCESS") { int[] serialids = new int[] { sid }; MemberAmountProcessor.SetAmountRequestStatus(serialids, 2, "微信企业付款:流水号" + rItem.payment_no, "", ManagerHelper.GetCurrentManager().UserName); int userId = rItem.UserId; MemberAmountRequestInfo balance = MemberAmountProcessor.GetAmountRequestDetail(sid); if (balance != null) { string url = Globals.FullPath("/Vshop/MemberAmountRequestDetail.aspx?Id=" + balance.Id); try { Messenger.SendWeiXinMsg_MemberAmountDrawCashRelease(balance, url); } catch { } } num3 += rItem.Amount / 100; num++; } else { if (((rItem.err_code == "OPENID_ERROR") || (rItem.err_code == "NAME_MISMATCH")) || (rItem.return_msg.Contains("openid字段") || (rItem.err_code == "FATAL_ERROR"))) { MemberAmountProcessor.SetAmountRequestStatus(new int[] { sid }, 3, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + rItem.return_msg, "", ManagerHelper.GetCurrentManager().UserName); } else { MemberAmountProcessor.SetAmountRequestStatus(new int[] { sid }, 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + rItem.return_msg, "", ManagerHelper.GetCurrentManager().UserName); } string str6 = str4; str4 = str6 + "<br>ID:" + rItem.partner_trade_no + ", 出错提示:" + rItem.return_msg; num2++; } } } count = (count - num2) - num; str4 = str4 + "</div>"; if ((num3 == num) && (num3 != 0)) { this.ShowMsg("全部支付成功", true); } else { this.ShowMsg(string.Concat(new object[] { "本次成功支付金额", num3, "元,其中成功", num, "笔,失败", num2, "笔,异常放弃", count, "笔", str4 }), false); } this.LoadParameters(); this.BindData(); } } } else if (str2 == "1") { this.ShowMsg("接口暂未开通", false); } else { this.ShowMsg("未定义支付方式", false); } }
private void BatchPaySend_Click(object sender, System.EventArgs e) { this.GetPaySetting(); if (string.IsNullOrEmpty(base.Request["CheckBoxGroup"])) { this.ShowMsg("参数错误!", false); return; } string text = base.Request["CheckBoxGroup"]; string value = this.PaybatchType.Value; if (value == "0") { string[] array = text.Split(new char[] { ',' }); System.Collections.Generic.List <OutPayWeiInfo> list = new System.Collections.Generic.List <OutPayWeiInfo>(); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string s = array2[i]; MemberAmountRequestInfo amountRequestDetail = MemberAmountProcessor.GetAmountRequestDetail(int.Parse(s)); if (amountRequestDetail != null && amountRequestDetail.State == RequesState.已审核 && this.DrawMinNum <= amountRequestDetail.Amount) { list.Add(new OutPayWeiInfo { Amount = (int)amountRequestDetail.Amount * 100, Partner_Trade_No = amountRequestDetail.RedpackId, Openid = amountRequestDetail.AccountCode, Re_User_Name = amountRequestDetail.AccountName, Desc = " 用户余额发放", UserId = amountRequestDetail.UserId, Nonce_Str = OutPayHelp.GetRandomString(20), Sid = amountRequestDetail.Id }); } } if (list.Count < 1) { this.ShowMsg("没有满足条件的提现请求!", false); this.LoadParameters(); this.BindData(); return; } System.Collections.Generic.List <WeiPayResult> list2 = OutPayHelp.BatchWeiPay(list); if (list2.Count < 1) { this.ShowMsg("系统异常,请联系管理员!", false); return; } if (list2[0].return_code == "INITFAIL") { this.ShowMsg(list2[0].return_msg, false); return; } int num = 0; int num2 = 0; int num3 = 0; int num4 = list.Count; string text2 = "<div class='errRow'>支付失败信息如下:"; using (System.Collections.Generic.List <WeiPayResult> .Enumerator enumerator = list2.GetEnumerator()) { while (enumerator.MoveNext()) { WeiPayResult rItem = enumerator.Current; int sid = list.FirstOrDefault((OutPayWeiInfo t) => t.Partner_Trade_No == rItem.partner_trade_no).Sid; if (rItem.result_code == "SUCCESS") { int[] serialids = new int[] { sid }; MemberAmountProcessor.SetAmountRequestStatus(serialids, 2, "微信企业付款:流水号" + rItem.payment_no, "", ManagerHelper.GetCurrentManager().UserName); int arg_298_0 = rItem.UserId; MemberAmountRequestInfo amountRequestDetail2 = MemberAmountProcessor.GetAmountRequestDetail(sid); if (amountRequestDetail2 != null) { string url = Globals.FullPath("/Vshop/MemberAmountRequestDetail.aspx?Id=" + amountRequestDetail2.Id); try { Messenger.SendWeiXinMsg_MemberAmountDrawCashRelease(amountRequestDetail2, url); } catch { } } num3 += rItem.Amount / 100; num++; } else { if (rItem.err_code == "OPENID_ERROR" || rItem.err_code == "NAME_MISMATCH" || rItem.return_msg.Contains("openid字段") || rItem.err_code == "FATAL_ERROR") { MemberAmountProcessor.SetAmountRequestStatus(new int[] { sid }, 3, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + rItem.return_msg, "", ManagerHelper.GetCurrentManager().UserName); } else { MemberAmountProcessor.SetAmountRequestStatus(new int[] { sid }, 1, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + rItem.return_msg, "", ManagerHelper.GetCurrentManager().UserName); } string text3 = text2; text2 = string.Concat(new string[] { text3, "<br>ID:", rItem.partner_trade_no, ", 出错提示:", rItem.return_msg }); num2++; } } } num4 = num4 - num2 - num; text2 += "</div>"; if (num3 == num && num3 != 0) { this.ShowMsg("全部支付成功", true); } else { this.ShowMsg(string.Concat(new object[] { "本次成功支付金额", num3, "元,其中成功", num, "笔,失败", num2, "笔,异常放弃", num4, "笔", text2 }), false); } this.LoadParameters(); this.BindData(); return; } else { if (value == "1") { this.ShowMsg("接口暂未开通", false); return; } this.ShowMsg("未定义支付方式", false); return; } }
private void WeiRedPack_Click(object sender, System.EventArgs e) { int num = Globals.ToNum(this.HiddenSid.Value); decimal num2 = decimal.Parse(this.hdreferralblance.Value); if (num2 > 200m) { this.ShowMsg("红包金额大于200,无法发放!", false); return; } MemberAmountRequestInfo amountRequestDetail = MemberAmountProcessor.GetAmountRequestDetail(num); if (amountRequestDetail == null || string.IsNullOrEmpty(amountRequestDetail.RedpackId)) { this.ShowMsg("发送失败0!", false); return; } if (amountRequestDetail.State == RequesState.已发放) { this.ShowMsg("该申请已经支付,请检查", false); return; } if (amountRequestDetail.State == RequesState.驳回) { this.ShowMsg("该申请已经驳回,请检查", false); return; } string text = this.SendRedPack(amountRequestDetail.AccountCode, "", "恭喜您提现成功!", "您的提现申请已成功", "会员余额发红包提现", (int)num2 * 100, amountRequestDetail.RedpackId); if (text == "success") { MemberAmountProcessor.SetAmountRequestStatus(new int[] { num }, 2, "微信红包付款", "", ManagerHelper.GetCurrentManager().UserName); string url = Globals.FullPath("/Vshop/MemberAmountRequestDetail.aspx?Id=" + amountRequestDetail.Id); try { Messenger.SendWeiXinMsg_MemberAmountDrawCashRelease(amountRequestDetail, url); } catch { } this.ShowMsg("红包发送成功!", true); this.LoadParameters(); this.BindData(); return; } if (text.Contains("openid")) { MemberAmountProcessor.SetAmountRequestStatus(new int[] { num }, 3, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + text, num2.ToString(), ManagerHelper.GetCurrentManager().UserName); this.LoadParameters(); this.BindData(); return; } MemberAmountProcessor.SetAmountRequestStatus(new int[] { num }, 1, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + text, num2.ToString(), ManagerHelper.GetCurrentManager().UserName); this.ShowMsg("发送失败,原因是:" + text, false); }
protected void Page_Load(object sender, System.EventArgs e) { System.Collections.Generic.SortedDictionary <string, string> requestPost = this.GetRequestPost(); if (requestPost.Count > 0) { Notify notify = new Notify(); bool flag = notify.Verify(requestPost, base.Request.Form["notify_id"], base.Request.Form["sign"]); if (flag) { string text = base.Request.Form["success_details"]; try { if (!string.IsNullOrEmpty(text)) { string[] array = text.Split(new char[] { '|' }); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text2 = array2[i]; string[] array3 = text2.Split(new char[] { '^' }); if (array3.Length >= 8) { MemberAmountRequestInfo amountRequestDetail = MemberAmountProcessor.GetAmountRequestDetail(int.Parse(array3[0])); if (amountRequestDetail != null && amountRequestDetail.State != RequesState.已发放) { int[] serialids = new int[] { int.Parse(array3[0]) }; MemberAmountProcessor.SetAmountRequestStatus(serialids, 2, "支付宝付款:流水号" + array3[6] + ",支付时间:" + array3[7], "", ManagerHelper.GetCurrentManager().UserName); string url = Globals.FullPath("/Vshop/MemberAmountRequestDetail.aspx?Id=" + amountRequestDetail.Id); try { Messenger.SendWeiXinMsg_MemberAmountDrawCashRelease(amountRequestDetail, url); } catch { } } } } } string text3 = base.Request.Form["fail_details"]; if (!string.IsNullOrEmpty(text3)) { string[] array4 = text3.Split(new char[] { '|' }); string[] array5 = array4; for (int j = 0; j < array5.Length; j++) { string text4 = array5[j]; string[] array6 = text4.Split(new char[] { '^' }); if (array6.Length >= 8) { MemberAmountRequestInfo amountRequestDetail2 = MemberAmountProcessor.GetAmountRequestDetail(int.Parse(array6[0])); if (amountRequestDetail2 != null && amountRequestDetail2.State != RequesState.已发放 && amountRequestDetail2.State != RequesState.驳回) { int[] serialids2 = new int[] { int.Parse(array6[0]) }; MemberAmountProcessor.SetAmountRequestStatus(serialids2, 3, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + array6[5] + array6[6], array6[3], ManagerHelper.GetCurrentManager().UserName); } } } } } catch (System.Exception ex) { try { Globals.Debuglog(string.Concat(new string[] { System.DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss]"), "验证成功,写入数据库失败->", base.Request.Form.ToString(), "||", ex.ToString() }), "_DebugLogAlipaynotify_url.txt"); } catch (System.Exception) { } } base.Response.Write("success"); return; } base.Response.Write("fail"); try { Globals.Debuglog(System.DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss]") + "验证失败1,写入数据库失败->" + base.Request.Form.ToString(), "_DebugLogAlipaynotify_url.txt"); return; } catch (System.Exception) { return; } } base.Response.Write("无通知参数"); }