protected void Page_Load(object sender, EventArgs e) { string str = ""; string str2 = base.Request.QueryString["vaid"]; if (!string.IsNullOrEmpty(str2)) { List <string> values = OneyuanTaoHelp.GetParticipantPids(str2, true, false, "alipay"); if (values.Count == 0) { base.Response.Write("没有适合支付宝退款的活动参与记录!"); return; } str = string.Join(",", values); } if (str == "") { str = base.Request.QueryString["pids"]; } if (string.IsNullOrEmpty(str)) { base.Response.Write("非正常访问!"); } else { IList <OneyuanTaoParticipantInfo> refundParticipantList = OneyuanTaoHelp.GetRefundParticipantList(str.Replace(" ", "").Replace(" ", "").Trim().Split(new char[] { ',' })); if (refundParticipantList == null) { base.Response.Write("获取夺宝信息失败,可能信息已删除!"); } else { List <alipayReturnInfo> refundList = new List <alipayReturnInfo>(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); foreach (OneyuanTaoParticipantInfo info in refundParticipantList) { if (((info.IsPay && !info.IsRefund) && (!info.IsWin && !string.IsNullOrEmpty(info.PayNum))) && (!string.IsNullOrEmpty(info.PayWay) && !(info.PayWay == "weixin"))) { alipayReturnInfo item = new alipayReturnInfo { alipaynum = info.PayNum, refundNum = info.TotalPrice, Remark = masterSettings.SiteName + "退款,对应活动编码:" + info.ActivityId }; refundList.Add(item); } } if (refundList.Count == 0) { base.Response.Write("当前选择的退款记录不符号退款条件,为非支付宝付款记录!"); } else { string s = RefundHelper.AlipayRefundRequest(string.Format("http://{0}/Admin/OutPay/OneyuanAlipayRefundNotify.aspx", base.Request.Url.Host), refundList); base.Response.Write(s); base.Response.End(); } } } }
protected void Page_Load(object sender, System.EventArgs e) { string text = ""; string text2 = base.Request.QueryString["vaid"]; if (!string.IsNullOrEmpty(text2)) { System.Collections.Generic.List <string> participantPids = OneyuanTaoHelp.GetParticipantPids(text2, true, false, "alipay"); if (participantPids.Count == 0) { base.Response.Write("没有适合支付宝退款的活动参与记录!"); return; } text = string.Join(",", participantPids); } if (text == "") { text = base.Request.QueryString["pids"]; } if (string.IsNullOrEmpty(text)) { base.Response.Write("非正常访问!"); return; } text = text.Replace("\u3000", "").Replace(" ", "").Trim(); string[] pIds = text.Split(new char[] { ',' }); System.Collections.Generic.IList <OneyuanTaoParticipantInfo> refundParticipantList = OneyuanTaoHelp.GetRefundParticipantList(pIds); if (refundParticipantList == null) { base.Response.Write("获取夺宝信息失败,可能信息已删除!"); return; } System.Collections.Generic.List <alipayReturnInfo> list = new System.Collections.Generic.List <alipayReturnInfo>(); foreach (OneyuanTaoParticipantInfo current in refundParticipantList) { if (current.IsPay && !current.IsRefund && !current.IsWin && !string.IsNullOrEmpty(current.PayNum) && !string.IsNullOrEmpty(current.PayWay) && !(current.PayWay == "weixin")) { alipayReturnInfo item = new alipayReturnInfo { alipaynum = current.PayNum, refundNum = current.TotalPrice, Remark = "一元夺宝退款,对应活动编码:" + current.ActivityId }; list.Add(item); } } if (list.Count == 0) { base.Response.Write("当前选择的退款记录不符号退款条件,为非支付宝付款记录!"); return; } string notify_url = string.Format("http://{0}/Admin/OutPay/OneyuanAlipayRefundNotify.aspx", base.Request.Url.Host); string s = RefundHelper.AlipayRefundRequest(notify_url, list); base.Response.Write(s); base.Response.End(); }
private void AjaxAction(string action) { string s = "{\"state\":false,\"msg\":\"未定义操作\"}"; NameValueCollection form = base.Request.Form; string str8 = action; if (str8 != null) { if (!(str8 == "WeiXinRefund")) { if (str8 == "WeiXinBacthRefund") { string pids = base.Request.Form["Pids"]; s = this.BatchWxRefund(pids); } else if (str8 == "BatchRefund") { s = "{\"state\":false,\"msg\":\"初始化中!\"}"; string str7 = base.Request.Form["vaid"]; if (string.IsNullOrEmpty(str7)) { s = "{\"state\":false,\"msg\":\"参数错误!\"}"; } else { List <string> list2 = OneyuanTaoHelp.GetParticipantPids(str7, true, false, "weixin"); if (list2.Count > 0) { string WxPids = string.Join(",", list2); new Thread(() => Globals.Debuglog(this.BatchWxRefund(WxPids), "_wxrefund.txt")).Start(); } if (OneyuanTaoHelp.GetParticipantPids(str7, true, false, "alipay").Count > 0) { s = "{\"state\":true,\"msg\":\"转向支付宝退款中...!\",\"alipay\":true}"; } else if (list2.Count > 0) { s = "{\"state\":true,\"msg\":\"正在后台处理微信退款,请稍后刷新!\",\"alipay\":false}"; } else { s = "{\"state\":false,\"msg\":\"没有退款数据可以操作!\",\"alipay\":false}"; OneyuanTaoHelp.SetIsAllRefund(new List <string> { str7 }); } } } } else { string str2 = form["Pid"]; if (!string.IsNullOrEmpty(str2)) { OneyuanTaoParticipantInfo info = OneyuanTaoHelp.GetAddParticipant(0, str2, ""); if ((info != null) && info.IsPay) { if (!info.IsRefund) { string str3 = info.out_refund_no; if (string.IsNullOrEmpty(str3)) { str3 = RefundHelper.GenerateRefundOrderId(); OneyuanTaoHelp.Setout_refund_no(str2, str3); } string wxRefundNum = ""; string str5 = RefundHelper.SendWxRefundRequest(str2, info.TotalPrice, info.TotalPrice, str3, out wxRefundNum); if (str5 == "") { s = "{\"state\":true,\"msg\":\"退款成功\"}"; info.Remark = "退款成功"; info.RefundNum = wxRefundNum; OneyuanTaoHelp.SetRefundinfo(info); OneyuanTaoHelp.SetIsAllRefund(new List <string> { info.ActivityId }); } else { info.Remark = "退款失败:" + str5.Replace("OK", ""); OneyuanTaoHelp.SetRefundinfoErr(info); s = "{\"state\":false,\"msg\":\"" + info.Remark + "\"}"; } } else { s = "{\"state\":false,\"msg\":\"该订单已退款!\"}"; } } else { s = "{\"state\":false,\"msg\":\"用户记录不存在或者用户未支付!\"}"; } } else { s = "{\"state\":false,\"msg\":\"参数错误!\"}"; } } } base.Response.ClearContent(); base.Response.ContentType = "application/json"; base.Response.Write(s); base.Response.End(); }
private void AjaxAction(string action) { string str = "{\"state\":false,\"msg\":\"未定义操作\"}"; NameValueCollection form = base.Request.Form; string str1 = action; string str2 = str1; if (str1 != null) { if (str2 == "WeiXinRefund") { string item = form["Pid"]; if (string.IsNullOrEmpty(item)) { str = "{\"state\":false,\"msg\":\"参数错误!\"}"; } else { OneyuanTaoParticipantInfo addParticipant = OneyuanTaoHelp.GetAddParticipant(0, item, ""); if (addParticipant == null || !addParticipant.IsPay) { str = "{\"state\":false,\"msg\":\"用户记录不存在或者用户未支付!\"}"; } else if (addParticipant.IsRefund) { str = "{\"state\":false,\"msg\":\"该订单已退款!\"}"; } else { string outRefundNo = addParticipant.out_refund_no; if (string.IsNullOrEmpty(outRefundNo)) { outRefundNo = RefundHelper.GenerateRefundOrderId(); OneyuanTaoHelp.Setout_refund_no(item, outRefundNo); } string str3 = ""; string str4 = RefundHelper.SendWxRefundRequest(item, addParticipant.TotalPrice, addParticipant.TotalPrice, outRefundNo, out str3); if (str4 != "") { addParticipant.Remark = string.Concat("退款失败:", str4.Replace("OK", "")); OneyuanTaoHelp.SetRefundinfoErr(addParticipant); str = string.Concat("{\"state\":false,\"msg\":\"", addParticipant.Remark, "\"}"); } else { str = "{\"state\":true,\"msg\":\"退款成功\"}"; addParticipant.Remark = "退款成功"; addParticipant.RefundNum = str3; OneyuanTaoHelp.SetRefundinfo(addParticipant); OneyuanTaoHelp.SetIsAllRefund(new List <string>() { addParticipant.ActivityId }); } } } } else if (str2 == "WeiXinBacthRefund") { string item1 = base.Request.Form["Pids"]; str = this.BatchWxRefund(item1); } else if (str2 == "BatchRefund") { str = "{\"state\":false,\"msg\":\"初始化中!\"}"; string item2 = base.Request.Form["vaid"]; if (!string.IsNullOrEmpty(item2)) { List <string> participantPids = OneyuanTaoHelp.GetParticipantPids(item2, true, false, "weixin"); if (participantPids.Count > 0) { string str5 = string.Join(",", participantPids); (new Thread(() => Globals.Debuglog(this.BatchWxRefund(str5), "_wxrefund.txt"))).Start(); } if (OneyuanTaoHelp.GetParticipantPids(item2, true, false, "alipay").Count > 0) { str = "{\"state\":true,\"msg\":\"转向支付宝退款中...!\",\"alipay\":true}"; } else if (participantPids.Count <= 0) { str = "{\"state\":false,\"msg\":\"没有退款数据可以操作!\",\"alipay\":false}"; OneyuanTaoHelp.SetIsAllRefund(new List <string>() { item2 }); } else { str = "{\"state\":true,\"msg\":\"正在后台处理微信退款,请稍后刷新!\",\"alipay\":false}"; } } else { str = "{\"state\":false,\"msg\":\"参数错误!\"}"; } } } base.Response.ClearContent(); base.Response.ContentType = "application/json"; base.Response.Write(str); base.Response.End(); }
private void AjaxAction(string action) { string s = "{\"state\":false,\"msg\":\"未定义操作\"}"; System.Collections.Specialized.NameValueCollection form = base.Request.Form; if (action != null) { if (!(action == "WeiXinRefund")) { if (!(action == "WeiXinBacthRefund")) { if (action == "BatchRefund") { string text = base.Request.Form["vaid"]; if (string.IsNullOrEmpty(text)) { s = "{\"state\":false,\"msg\":\"参数错误!\"}"; } else { System.Collections.Generic.List <string> participantPids = OneyuanTaoHelp.GetParticipantPids(text, true, false, "weixin"); if (participantPids.Count > 0) { string WxPids = string.Join(",", participantPids); new System.Threading.Thread(() => { Globals.Debuglog(this.BatchWxRefund(WxPids), "_wxrefund.txt"); }).Start(); } System.Collections.Generic.List <string> participantPids2 = OneyuanTaoHelp.GetParticipantPids(text, true, false, "alipay"); if (participantPids2.Count > 0) { s = "{\"state\":true,\"msg\":\"转向支付宝退款中...!\",\"alipay\":true}"; } else if (participantPids.Count > 0) { s = "{\"state\":true,\"msg\":\"正在后台处理微信退款,请稍后刷新!\",\"alipay\":false}"; } else { s = "{\"state\":false,\"msg\":\"没有退款数据可以操作!\",\"alipay\":false}"; OneyuanTaoHelp.SetIsAllRefund(new System.Collections.Generic.List <string> { text }); } } } } else { string pids = base.Request.Form["Pids"]; s = this.BatchWxRefund(pids); } } else { string text2 = form["Pid"]; if (!string.IsNullOrEmpty(text2)) { OneyuanTaoParticipantInfo addParticipant = OneyuanTaoHelp.GetAddParticipant(0, text2, ""); if (addParticipant != null && addParticipant.IsPay) { if (!addParticipant.IsRefund) { string text3 = addParticipant.out_refund_no; if (string.IsNullOrEmpty(text3)) { text3 = RefundHelper.GenerateRefundOrderId(); OneyuanTaoHelp.Setout_refund_no(text2, text3); } string refundNum = ""; string text4 = RefundHelper.SendWxRefundRequest(text2, addParticipant.TotalPrice, addParticipant.TotalPrice, text3, out refundNum); if (text4 == "") { s = "{\"state\":true,\"msg\":\"退款成功\"}"; addParticipant.Remark = "退款成功"; addParticipant.RefundNum = refundNum; OneyuanTaoHelp.SetRefundinfo(addParticipant); OneyuanTaoHelp.SetIsAllRefund(new System.Collections.Generic.List <string> { addParticipant.ActivityId }); } else { addParticipant.Remark = "退款失败:" + text4.Replace("OK", ""); OneyuanTaoHelp.SetRefundinfoErr(addParticipant); s = "{\"state\":false,\"msg\":\"" + addParticipant.Remark + "\"}"; } } else { s = "{\"state\":false,\"msg\":\"该订单已退款!\"}"; } } else { s = "{\"state\":false,\"msg\":\"用户记录不存在或者用户未支付!\"}"; } } else { s = "{\"state\":false,\"msg\":\"参数错误!\"}"; } } } base.Response.ClearContent(); base.Response.ContentType = "application/json"; base.Response.Write(s); base.Response.End(); }