代码修改后的版本,全部提交
This commit is contained in:
16
Mtxfw.shop/pay/alipay.aspx
Normal file
16
Mtxfw.shop/pay/alipay.aspx
Normal file
@@ -0,0 +1,16 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="alipay.aspx.cs" Inherits="Mtxfw.shop.alipay" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title></title>
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<form runat="server">
|
||||
正在请求中...
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
126
Mtxfw.shop/pay/alipay.aspx.cs
Normal file
126
Mtxfw.shop/pay/alipay.aspx.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Text;
|
||||
namespace Mtxfw.shop
|
||||
{
|
||||
public partial class alipay : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
try
|
||||
{
|
||||
////////////////////////////////////////////请求参数////////////////////////////////////////////
|
||||
if (!String.IsNullOrEmpty(Request.QueryString["t"]) && !String.IsNullOrEmpty(Request.QueryString["oids"]) && !String.IsNullOrEmpty(Request.QueryString["amount"]))
|
||||
{
|
||||
string t = Request.QueryString["t"].ToString();
|
||||
string OIDs = Request.QueryString["oids"].ToString();
|
||||
string orderAmount = Request.QueryString["amount"].ToString();
|
||||
//支付类型
|
||||
string payment_type = "1";
|
||||
//必填,不能修改
|
||||
//服务器异步通知页面路径
|
||||
string notify_url = "http://shop.q-b.cc/pay/notify_url.aspx";
|
||||
//需http://格式的完整路径,不能加?id=123这类自定义参数
|
||||
|
||||
//页面跳转同步通知页面路径
|
||||
string return_url = "http://shop.q-b.cc/pay/return_url.aspx";
|
||||
//需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/
|
||||
|
||||
//卖家支付宝帐户
|
||||
string seller_email = "glqiaobao520@126.com";
|
||||
//必填
|
||||
|
||||
//商户订单号
|
||||
string out_trade_no = OIDs;
|
||||
//商户网站订单系统中唯一订单号,必填
|
||||
|
||||
//订单名称
|
||||
string subject = (t == "1" ? "购买商品付款" : "账户充值");
|
||||
//必填
|
||||
|
||||
//付款金额
|
||||
string total_fee = orderAmount;
|
||||
//必填
|
||||
|
||||
//订单描述
|
||||
|
||||
string body = "";
|
||||
//默认支付方式
|
||||
string paymethod = "bankPay";
|
||||
//必填
|
||||
//默认网银
|
||||
string defaultbank = "";
|
||||
|
||||
if (Request.QueryString["pay_bank"] != null)
|
||||
{
|
||||
if (Request.QueryString["pay_bank"].Trim() != "")
|
||||
{
|
||||
if (Request.QueryString["pay_bank"] == "directPay")
|
||||
{
|
||||
paymethod = "directPay";
|
||||
}
|
||||
else
|
||||
{
|
||||
paymethod = "bankPay";
|
||||
defaultbank = Request.QueryString["pay_bank"];
|
||||
}
|
||||
}
|
||||
}
|
||||
//必填,银行简码请参考接口技术文档
|
||||
|
||||
//商品展示地址
|
||||
string show_url = "http://shop.q-b.cc/";
|
||||
//需以http://开头的完整路径,例如:http://www.xxx.com/myorder.html
|
||||
|
||||
//防钓鱼时间戳
|
||||
string anti_phishing_key = Mtxfw.Utility.Submit.Query_timestamp();
|
||||
//若要使用请调用类文件submit中的query_timestamp函数
|
||||
|
||||
//客户端的IP地址
|
||||
string exter_invoke_ip = Mtxfw.Utility.Common.GetIP;
|
||||
//非局域网的外网IP地址,如:221.0.0.1
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//把请求参数打包成数组
|
||||
SortedDictionary<string, string> sParaTemp = new SortedDictionary<string, string>();
|
||||
sParaTemp.Add("partner", Mtxfw.Utility.AlipayConfig.Partner);
|
||||
sParaTemp.Add("_input_charset", Mtxfw.Utility.AlipayConfig.Input_charset.ToLower());
|
||||
sParaTemp.Add("service", "create_direct_pay_by_user");
|
||||
sParaTemp.Add("payment_type", payment_type);
|
||||
sParaTemp.Add("notify_url", notify_url);
|
||||
sParaTemp.Add("return_url", return_url);
|
||||
sParaTemp.Add("seller_email", seller_email);
|
||||
sParaTemp.Add("out_trade_no", out_trade_no);
|
||||
sParaTemp.Add("subject", subject);
|
||||
sParaTemp.Add("total_fee", total_fee);
|
||||
sParaTemp.Add("body", body);
|
||||
sParaTemp.Add("paymethod", paymethod);
|
||||
sParaTemp.Add("defaultbank", defaultbank);
|
||||
sParaTemp.Add("show_url", show_url);
|
||||
sParaTemp.Add("anti_phishing_key", anti_phishing_key);
|
||||
sParaTemp.Add("exter_invoke_ip", exter_invoke_ip);
|
||||
|
||||
//建立请求
|
||||
string sHtmlText = Mtxfw.Utility.Submit.BuildRequest(sParaTemp, "post", "确认");
|
||||
Response.Write(sHtmlText);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/weixin1.txt", err.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
15
Mtxfw.shop/pay/alipay.aspx.designer.cs
generated
Normal file
15
Mtxfw.shop/pay/alipay.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Mtxfw.shop {
|
||||
|
||||
|
||||
public partial class alipay {
|
||||
}
|
||||
}
|
||||
13
Mtxfw.shop/pay/kq_receive.aspx
Normal file
13
Mtxfw.shop/pay/kq_receive.aspx
Normal file
@@ -0,0 +1,13 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="kq_receive.aspx.cs" Inherits="Mtxfw.shop.kq_receive" %>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" >
|
||||
<head id="Head1" runat="server">
|
||||
<title>快钱支付结果页面</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
204
Mtxfw.shop/pay/kq_receive.aspx.cs
Normal file
204
Mtxfw.shop/pay/kq_receive.aspx.cs
Normal file
@@ -0,0 +1,204 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
namespace Mtxfw.shop
|
||||
{
|
||||
/// <summary>
|
||||
/// 功能:服务器异步通知页面
|
||||
/// 版本:3.3
|
||||
/// 日期:2012-07-10
|
||||
/// 说明:
|
||||
/// 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
/// 该代码仅供学习和研究支付宝接口使用,只是提供一个参考。
|
||||
///
|
||||
/// ///////////////////页面功能说明///////////////////
|
||||
/// 创建该页面文件时,请留心该页面文件中无任何HTML代码及空格。
|
||||
/// 该页面不能在本机电脑测试,请到服务器上做测试。请确保外部可以访问该页面。
|
||||
/// 该页面调试工具请使用写文本函数logResult。
|
||||
/// 如果没有收到该页面返回的 success 信息,支付宝会在24小时内按一定的时间策略重发通知
|
||||
/// </summary>
|
||||
public partial class kq_receive : System.Web.UI.Page
|
||||
{
|
||||
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||||
Mtxfw.DAL.order_info daoorder = new Mtxfw.DAL.order_info();
|
||||
Mtxfw.DAL.user_Results_jl2 daoResults2 = new Mtxfw.DAL.user_Results_jl2();
|
||||
Mtxfw.DAL.order_product_info daoorderproduct = new Mtxfw.DAL.order_product_info();
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
try
|
||||
{
|
||||
//人民币网关账号,该账号为11位人民币网关商户编号+01,该值与提交时相同。
|
||||
string merchantAcctId = Request.QueryString["merchantAcctId"].ToString();
|
||||
//网关版本,固定值:v2.0,该值与提交时相同。
|
||||
string version = Request.QueryString["version"].ToString();
|
||||
//语言种类,1代表中文显示,2代表英文显示。默认为1,该值与提交时相同。
|
||||
string language = Request.QueryString["language"].ToString();
|
||||
//签名类型,该值为4,代表PKI加密方式,该值与提交时相同。
|
||||
string signType = Request.QueryString["signType"].ToString();
|
||||
//支付方式,一般为00,代表所有的支付方式。如果是银行直连商户,该值为10,该值与提交时相同。
|
||||
string payType = Request.QueryString["payType"].ToString();
|
||||
//银行代码,如果payType为00,该值为空;如果payType为10,该值与提交时相同。
|
||||
string bankId = Request.QueryString["bankId"].ToString();
|
||||
//商户订单号,,该值与提交时相同。
|
||||
string orderId = Request.QueryString["orderId"].ToString();
|
||||
//订单提交时间,格式:yyyyMMddHHmmss,如:20071117020101,该值与提交时相同。
|
||||
string orderTime = Request.QueryString["orderTime"].ToString();
|
||||
//订单金额,金额以“分”为单位,商户测试以1分测试即可,切勿以大金额测试,该值与支付时相同。
|
||||
string orderAmount = Request.QueryString["orderAmount"].ToString();
|
||||
// 快钱交易号,商户每一笔交易都会在快钱生成一个交易号。
|
||||
string dealId = Request.QueryString["dealId"].ToString();
|
||||
//银行交易号 ,快钱交易在银行支付时对应的交易号,如果不是通过银行卡支付,则为空
|
||||
string bankDealId = Request.QueryString["bankDealId"].ToString();
|
||||
//快钱交易时间,快钱对交易进行处理的时间,格式:yyyyMMddHHmmss,如:20071117020101
|
||||
string dealTime = Request.QueryString["dealTime"].ToString();
|
||||
//商户实际支付金额 以分为单位。比方10元,提交时金额应为1000。该金额代表商户快钱账户最终收到的金额。
|
||||
string payAmount = Request.QueryString["payAmount"].ToString();
|
||||
//费用,快钱收取商户的手续费,单位为分。
|
||||
string fee = Request.QueryString["fee"].ToString();
|
||||
//扩展字段1,该值与提交时相同。
|
||||
string ext1 = Request.QueryString["ext1"].ToString();
|
||||
//扩展字段2,该值与提交时相同。
|
||||
string ext2 = Request.QueryString["ext2"].ToString();
|
||||
//处理结果, 10支付成功,11 支付失败,00订单申请成功,01 订单申请失败
|
||||
string payResult = Request.QueryString["payResult"].ToString();
|
||||
//错误代码 ,请参照《人民币网关接口文档》最后部分的详细解释。
|
||||
string errCode = Request.QueryString["errCode"].ToString();
|
||||
//签名字符串
|
||||
string signMsg = Request.QueryString["signMsg"].ToString();
|
||||
string signMsgVal = "";
|
||||
signMsgVal = appendParam(signMsgVal, "merchantAcctId", merchantAcctId);
|
||||
signMsgVal = appendParam(signMsgVal, "version", version);
|
||||
signMsgVal = appendParam(signMsgVal, "language", language);
|
||||
signMsgVal = appendParam(signMsgVal, "signType", signType);
|
||||
signMsgVal = appendParam(signMsgVal, "payType", payType);
|
||||
signMsgVal = appendParam(signMsgVal, "bankId", bankId);
|
||||
signMsgVal = appendParam(signMsgVal, "orderId", orderId);
|
||||
signMsgVal = appendParam(signMsgVal, "orderTime", orderTime);
|
||||
signMsgVal = appendParam(signMsgVal, "orderAmount", orderAmount);
|
||||
signMsgVal = appendParam(signMsgVal, "dealId", dealId);
|
||||
signMsgVal = appendParam(signMsgVal, "bankDealId", bankDealId);
|
||||
signMsgVal = appendParam(signMsgVal, "dealTime", dealTime);
|
||||
signMsgVal = appendParam(signMsgVal, "payAmount", payAmount);
|
||||
signMsgVal = appendParam(signMsgVal, "fee", fee);
|
||||
signMsgVal = appendParam(signMsgVal, "ext1", ext1);
|
||||
signMsgVal = appendParam(signMsgVal, "ext2", ext2);
|
||||
signMsgVal = appendParam(signMsgVal, "payResult", payResult);
|
||||
signMsgVal = appendParam(signMsgVal, "errCode", errCode);
|
||||
|
||||
///UTF-8编码 GB2312编码 用户可以根据自己网站的编码格式来选择加密的编码方式
|
||||
byte[] bytes = System.Text.Encoding.GetEncoding("GB2312").GetBytes(signMsgVal);
|
||||
//byte[] bytes = System.Text.Encoding.UTF8.GetBytes(signMsgVal);
|
||||
byte[] SignatureByte = Convert.FromBase64String(signMsg);
|
||||
X509Certificate2 cert = new X509Certificate2(Server.MapPath("/App_Data/public-rsa.cer"), "");
|
||||
RSACryptoServiceProvider rsapri = (RSACryptoServiceProvider)cert.PublicKey.Key;
|
||||
rsapri.ImportCspBlob(rsapri.ExportCspBlob(false));
|
||||
RSAPKCS1SignatureDeformatter f = new RSAPKCS1SignatureDeformatter(rsapri);
|
||||
byte[] result;
|
||||
f.SetHashAlgorithm("SHA1");
|
||||
SHA1CryptoServiceProvider sha = new SHA1CryptoServiceProvider();
|
||||
result = sha.ComputeHash(bytes);
|
||||
|
||||
|
||||
if (f.VerifySignature(result, SignatureByte))
|
||||
{
|
||||
//逻辑处理 写入数据库
|
||||
if (payResult == "10")
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//请在这里加上商户的业务逻辑程序代码
|
||||
|
||||
|
||||
//——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
|
||||
//获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表
|
||||
|
||||
|
||||
//判断该笔订单是否在商户网站中已经做过处理
|
||||
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
|
||||
//如果有做过处理,不执行商户的业务程序
|
||||
|
||||
//注意:
|
||||
//该种交易状态只在两种情况下出现
|
||||
//1、开通了普通即时到账,买家付款成功后。
|
||||
//2、开通了高级即时到账,从该笔交易成功时间算起,过了签约时的可退款时限(如:三个月以内可退款、一年以内可退款等)后。
|
||||
Mtxfw.Model.user_Results_jl2 ReModel = daoResults2.GetModel(orderId);
|
||||
if (ReModel != null)
|
||||
{
|
||||
if (ReModel.Seef == 0)
|
||||
{
|
||||
if (Convert.ToDouble(ReModel.Addmoney.ToString("f2")) == Convert.ToDouble((Convert.ToDouble(orderAmount) / 100).ToString("f2")))
|
||||
{
|
||||
daoResults2.UpdateSeef("seef", 1, "seeftime", DateTime.Now, ReModel.Id);
|
||||
//增加买家余额
|
||||
daoUser.UpdateMoney("umoney12", ReModel.Addmoney, ReModel.MemberId);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/weixinerr.txt", payAmount);
|
||||
//打印页面
|
||||
Response.Write("<result>1</result>" + "<redirecturl>http://www.hzmfgw.com/pay/kqshow.aspx?msg=0&payAmount=" + payAmount + "</redirecturl>");
|
||||
}
|
||||
else
|
||||
{
|
||||
//以下是我们快钱设置的show页面,商户需要自己定义该页面。
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/weixinerr.txt", payAmount + "|" + payResult);
|
||||
Response.Write("<result>1</result>" + "<redirecturl>http://www.hzmfgw.com/pay/kqshow.aspx?msg=1</redirecturl>");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/weixinerr.txt", signMsgVal + "|" + signMsg);
|
||||
Response.Write("signMsgVal=" + "(" + signMsgVal + ")");
|
||||
Response.Write("</br>" + "signMsg =" + signMsg);
|
||||
Response.Write("</br>" + "错误");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/weixinerr.txt", ex.ToString() + "|" + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
//功能函数。将变量值不为空的参数组成字符串
|
||||
String appendParam(String returnStr, String paramId, String paramValue)
|
||||
{
|
||||
|
||||
if (returnStr != "")
|
||||
{
|
||||
|
||||
if (paramValue != "")
|
||||
{
|
||||
|
||||
returnStr += "&" + paramId + "=" + paramValue;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (paramValue != "")
|
||||
{
|
||||
returnStr = paramId + "=" + paramValue;
|
||||
}
|
||||
}
|
||||
|
||||
return returnStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Mtxfw.shop/pay/kq_receive.aspx.designer.cs
generated
Normal file
33
Mtxfw.shop/pay/kq_receive.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,33 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Mtxfw.shop {
|
||||
|
||||
|
||||
public partial class kq_receive {
|
||||
|
||||
/// <summary>
|
||||
/// Head1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
}
|
||||
}
|
||||
44
Mtxfw.shop/pay/kqpay.aspx
Normal file
44
Mtxfw.shop/pay/kqpay.aspx
Normal file
@@ -0,0 +1,44 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="kqpay.aspx.cs" Inherits="Mtxfw.shop.kqpay" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title></title>
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
|
||||
<script src="/scripts/jquery-1.7.2.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
正在请求中...
|
||||
<form name="kqPay" id="kqPay" action="https://www.99bill.com/gateway/recvMerchantInfoAction.htm" method="post" target="_self">
|
||||
|
||||
<input type="hidden" name="orderAmount" Class="k4" value="<%=orderAmount%>" />
|
||||
<input type="hidden" name="inputCharset" value="<%=inputCharset%>" />
|
||||
<input type="hidden" name="pageUrl" value="<%=pageUrl%>" />
|
||||
<input type="hidden" name="bgUrl" value="<%=bgUrl%>" />
|
||||
<input type="hidden" name="version" value="<%=version%>" />
|
||||
<input type="hidden" name="language" value="<%=language%>" />
|
||||
<input type="hidden" name="signType" value="<%=signType%>" />
|
||||
<input type="hidden" name="signMsg" value="<%=signMsg%>" />
|
||||
<input type="hidden" name="merchantAcctId" value="<%=merchantAcctId%>" />
|
||||
<input type="hidden" name="payerName" value="<%=payerName%>" />
|
||||
<input type="hidden" name="payerContactType" value="<%=payerContactType%>" />
|
||||
<input type="hidden" name="payerContact" value="<%=payerContact%>" />
|
||||
<input type="hidden" name="orderId" value="<%=orderId%>" />
|
||||
|
||||
<input type="hidden" name="orderTime" value="<%=orderTime%>" />
|
||||
<input type="hidden" name="productName" value="<%=productName%>" />
|
||||
<input type="hidden" name="productNum" value="<%=productNum%>" />
|
||||
<input type="hidden" name="productId" value="<%=productId%>" />
|
||||
<input type="hidden" name="productDesc" value="<%=productDesc%>" />
|
||||
<input type="hidden" name="ext1" value="<%=ext1%>" />
|
||||
<input type="hidden" name="ext2" value="<%=ext2%>" />
|
||||
<input type="hidden" name="payType" value="<%=payType%>" />
|
||||
<input type="hidden" name="bankId" value="<%=bankId%>" />
|
||||
<input type="hidden" name="redoFlag" value="<%=redoFlag%>" />
|
||||
<input type="hidden" name="pid" value="<%=pid%>" />
|
||||
</form>
|
||||
<asp:label ID="label_msg" runat="server"></asp:label>
|
||||
</body>
|
||||
</html>
|
||||
176
Mtxfw.shop/pay/kqpay.aspx.cs
Normal file
176
Mtxfw.shop/pay/kqpay.aspx.cs
Normal file
@@ -0,0 +1,176 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
namespace Mtxfw.shop
|
||||
{
|
||||
public partial class kqpay : System.Web.UI.Page
|
||||
{
|
||||
#region 参数说明
|
||||
//人民币网关账号,该账号为11位人民币网关商户账号+01,该参数必填。
|
||||
public string merchantAcctId = "1002221632301";
|
||||
//编码方式,1代表 UTF-8; 2 代表 GBK; 3代表 GB2312 默认为1,该参数必填。
|
||||
public string inputCharset = "3";
|
||||
//接收支付结果的页面地址,该参数一般置为空即可。
|
||||
public string pageUrl = "";
|
||||
//服务器接收支付结果的后台地址,该参数务必填写,不能为空。
|
||||
public string bgUrl = "http://www.hzmfgw.com/pay/kq_receive.aspx";
|
||||
//网关版本,固定值:v2.0,该参数必填。
|
||||
public string version = "v2.0";
|
||||
//语言种类,1代表中文显示,2代表英文显示。默认为1,该参数必填。
|
||||
public string language = "1";
|
||||
//签名类型,该值为4,代表PKI加密方式,该参数必填。
|
||||
public string signType = "4";
|
||||
//支付人姓名,可以为空。
|
||||
public string payerName = "";
|
||||
//支付人联系类型,1 代表电子邮件方式;2 代表手机联系方式。可以为空。
|
||||
public string payerContactType = "";
|
||||
//支付人联系方式,与payerContactType设置对应,payerContactType为1,则填写邮箱地址;payerContactType为2,则填写手机号码。可以为空。
|
||||
public string payerContact = "";
|
||||
//商户订单号,以下采用时间来定义订单号,商户可以根据自己订单号的定义规则来定义该值,不能为空。
|
||||
public string orderId = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
//订单金额,金额以“分”为单位,商户测试以1分测试即可,切勿以大金额测试。该参数必填。
|
||||
public string orderAmount = "1";
|
||||
//订单提交时间,格式:yyyyMMddHHmmss,如:20071117020101,不能为空。
|
||||
public string orderTime = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
//商品名称,可以为空。
|
||||
public string productName = "付款";
|
||||
//商品数量,可以为空。
|
||||
public string productNum = "1";
|
||||
//商品代码,可以为空。
|
||||
public string productId = "55558888";
|
||||
//商品描述,可以为空。
|
||||
public string productDesc = "";
|
||||
//扩展字段1,商户可以传递自己需要的参数,支付完快钱会原值返回,可以为空。
|
||||
public string ext1 = "";
|
||||
//扩展自段2,商户可以传递自己需要的参数,支付完快钱会原值返回,可以为空。
|
||||
public string ext2 = "";
|
||||
//支付方式,一般为00,代表所有的支付方式。如果是银行直连商户,该值为10,必填。
|
||||
public string payType = "00";
|
||||
//银行代码,如果payType为00,该值可以为空;如果payType为10,该值必须填写,具体请参考银行列表。
|
||||
public string bankId = "";
|
||||
//同一订单禁止重复提交标志,实物购物车填1,虚拟产品用0。1代表只能提交一次,0代表在支付不成功情况下可以再提交。可为空。
|
||||
public string redoFlag = "";
|
||||
//快钱合作伙伴的帐户号,即商户账号,可为空。
|
||||
public string pid = "";
|
||||
// signMsg 签名字符串 不可空,生成加密签名串
|
||||
public string signMsg = "";
|
||||
#endregion
|
||||
Mtxfw.Utility.Config config = new Mtxfw.Utility.Config();
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
try
|
||||
{
|
||||
////////////////////////////////////////////请求参数////////////////////////////////////////////
|
||||
|
||||
Double Addmoney = Convert.ToDouble(config.webMoney1) * 100;
|
||||
orderAmount = (Convert.ToDouble(config.webMoney1)*100).ToString();
|
||||
|
||||
//商户订单号
|
||||
orderId = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
||||
mjl2.MemberId = 0;
|
||||
mjl2.MemberId2 = 0;
|
||||
mjl2.Addmoney = Addmoney;
|
||||
mjl2.Cutmoney =0;
|
||||
mjl2.Totalmoney = Addmoney;
|
||||
mjl2.addtime = DateTime.Now;
|
||||
mjl2.BZContent = "付款测试通道";
|
||||
mjl2.PayID = orderId;
|
||||
mjl2.OrdersIDs = "";
|
||||
mjl2.OrdersID = 0;
|
||||
mjl2.utype = 2;
|
||||
mjl2.utype2 = 1;
|
||||
mjl2.Seef = 0;
|
||||
mjl2.seeftime = DateTime.Now;
|
||||
new DAL.user_Results_jl2().Add(mjl2);
|
||||
//订单名称
|
||||
///productDesc = (t == "1" ? "购买商品付款" : "账户充值");
|
||||
|
||||
if (Request.QueryString["pay_bank"] != null)
|
||||
{
|
||||
if (Request.QueryString["pay_bank"].Trim() != "")
|
||||
{
|
||||
payType = Request.QueryString["pay_bank"];
|
||||
}
|
||||
}
|
||||
//拼接字符串
|
||||
string signMsgVal = "";
|
||||
signMsgVal = appendParam(signMsgVal, "inputCharset", inputCharset);
|
||||
signMsgVal = appendParam(signMsgVal, "pageUrl", pageUrl);
|
||||
signMsgVal = appendParam(signMsgVal, "bgUrl", bgUrl);
|
||||
signMsgVal = appendParam(signMsgVal, "version", version);
|
||||
signMsgVal = appendParam(signMsgVal, "language", language);
|
||||
signMsgVal = appendParam(signMsgVal, "signType", signType);
|
||||
signMsgVal = appendParam(signMsgVal, "merchantAcctId", merchantAcctId);
|
||||
signMsgVal = appendParam(signMsgVal, "payerName", payerName);
|
||||
signMsgVal = appendParam(signMsgVal, "payerContactType", payerContactType);
|
||||
signMsgVal = appendParam(signMsgVal, "payerContact", payerContact);
|
||||
signMsgVal = appendParam(signMsgVal, "orderId", orderId);
|
||||
signMsgVal = appendParam(signMsgVal, "orderAmount", orderAmount);
|
||||
signMsgVal = appendParam(signMsgVal, "orderTime", orderTime);
|
||||
signMsgVal = appendParam(signMsgVal, "productName", productName);
|
||||
signMsgVal = appendParam(signMsgVal, "productNum", productNum);
|
||||
signMsgVal = appendParam(signMsgVal, "productId", productId);
|
||||
signMsgVal = appendParam(signMsgVal, "productDesc", productDesc);
|
||||
signMsgVal = appendParam(signMsgVal, "ext1", ext1);
|
||||
signMsgVal = appendParam(signMsgVal, "ext2", ext2);
|
||||
signMsgVal = appendParam(signMsgVal, "payType", payType);
|
||||
signMsgVal = appendParam(signMsgVal, "redoFlag", redoFlag);
|
||||
signMsgVal = appendParam(signMsgVal, "pid", pid);
|
||||
|
||||
///PKI加密
|
||||
///编码方式UTF-8 GB2312 用户可以根据自己系统的编码选择对应的加密方式
|
||||
byte[] bytes = System.Text.Encoding.GetEncoding("GB2312").GetBytes(signMsgVal);
|
||||
//byte[] bytes = System.Text.Encoding.UTF8.GetBytes(signMsgVal);
|
||||
X509Certificate2 cert = new X509Certificate2(HttpContext.Current.Server.MapPath("/App_Data/99bill-rsa.pfx"), "123456", X509KeyStorageFlags.MachineKeySet);
|
||||
RSACryptoServiceProvider rsapri = (RSACryptoServiceProvider)cert.PrivateKey;
|
||||
RSAPKCS1SignatureFormatter f = new RSAPKCS1SignatureFormatter(rsapri);
|
||||
byte[] result;
|
||||
f.SetHashAlgorithm("SHA1");
|
||||
SHA1CryptoServiceProvider sha = new SHA1CryptoServiceProvider();
|
||||
result = sha.ComputeHash(bytes);
|
||||
signMsg = System.Convert.ToBase64String(f.CreateSignature(result)).ToString();
|
||||
|
||||
label_msg.Text = "<script> $(document).ready(function () {document.forms['kqPay'].submit();});</script>";
|
||||
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/weixin1.txt", err.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//功能函数。将变量值不为空的参数组成字符串
|
||||
#region 字符串串联函数
|
||||
public string appendParam(string returnStr, string paramId, string paramValue)
|
||||
{
|
||||
if (returnStr != "")
|
||||
{
|
||||
if (paramValue != "")
|
||||
{
|
||||
returnStr += "&" + paramId + "=" + paramValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (paramValue != "")
|
||||
{
|
||||
returnStr = paramId + "=" + paramValue;
|
||||
}
|
||||
}
|
||||
return returnStr;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
24
Mtxfw.shop/pay/kqpay.aspx.designer.cs
generated
Normal file
24
Mtxfw.shop/pay/kqpay.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,24 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Mtxfw.shop {
|
||||
|
||||
|
||||
public partial class kqpay {
|
||||
|
||||
/// <summary>
|
||||
/// label_msg 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label label_msg;
|
||||
}
|
||||
}
|
||||
20
Mtxfw.shop/pay/kqshow.aspx
Normal file
20
Mtxfw.shop/pay/kqshow.aspx
Normal file
@@ -0,0 +1,20 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" Inherits="kqshow" Codebehind="kqshow.aspx.cs" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<BODY>
|
||||
<div align="center">
|
||||
<h2 align="center">快钱支付结果页面</h2>
|
||||
<font color="#ff0000">(该页面仅做参考)</font>
|
||||
<table width="500" border="1" style="border-collapse: collapse" bordercolor="green" align="center">
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</BODY>
|
||||
</body>
|
||||
</html>
|
||||
24
Mtxfw.shop/pay/kqshow.aspx.cs
Normal file
24
Mtxfw.shop/pay/kqshow.aspx.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class kqshow : System.Web.UI.Page
|
||||
{
|
||||
public string msg = "";
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
msg = Request.QueryString["msg"].ToString().Trim();
|
||||
|
||||
if (msg == "0")
|
||||
{
|
||||
Mtxfw.Utility.Tools.Message("您已经成功付款", "/");
|
||||
}
|
||||
if (msg == "1")
|
||||
{
|
||||
Mtxfw.Utility.Tools.Message("您的付款因网络原因失败,有疑问请与管理员联系", "/");
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Mtxfw.shop/pay/kqshow.aspx.designer.cs
generated
Normal file
13
Mtxfw.shop/pay/kqshow.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
public partial class kqshow {
|
||||
}
|
||||
1
Mtxfw.shop/pay/notify_url.aspx
Normal file
1
Mtxfw.shop/pay/notify_url.aspx
Normal file
@@ -0,0 +1 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="notify_url.aspx.cs" Inherits="Mtxfw.shop.notify_url" %>
|
||||
324
Mtxfw.shop/pay/notify_url.aspx.cs
Normal file
324
Mtxfw.shop/pay/notify_url.aspx.cs
Normal file
@@ -0,0 +1,324 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
namespace Mtxfw.shop
|
||||
{
|
||||
/// <summary>
|
||||
/// 功能:服务器异步通知页面
|
||||
/// 版本:3.3
|
||||
/// 日期:2012-07-10
|
||||
/// 说明:
|
||||
/// 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
/// 该代码仅供学习和研究支付宝接口使用,只是提供一个参考。
|
||||
///
|
||||
/// ///////////////////页面功能说明///////////////////
|
||||
/// 创建该页面文件时,请留心该页面文件中无任何HTML代码及空格。
|
||||
/// 该页面不能在本机电脑测试,请到服务器上做测试。请确保外部可以访问该页面。
|
||||
/// 该页面调试工具请使用写文本函数logResult。
|
||||
/// 如果没有收到该页面返回的 success 信息,支付宝会在24小时内按一定的时间策略重发通知
|
||||
/// </summary>
|
||||
public partial class notify_url : System.Web.UI.Page
|
||||
{
|
||||
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||||
Mtxfw.DAL.order_info daoorder = new Mtxfw.DAL.order_info();
|
||||
Mtxfw.DAL.user_Results_jl2 daoResults2 = new Mtxfw.DAL.user_Results_jl2();
|
||||
Mtxfw.DAL.order_product_info daoorderproduct = new Mtxfw.DAL.order_product_info();
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
SortedDictionary<string, string> sPara = GetRequestPost();
|
||||
|
||||
if (sPara.Count > 0)//判断是否有带返回参数
|
||||
{
|
||||
Mtxfw.Utility.Notify aliNotify = new Mtxfw.Utility.Notify();
|
||||
bool verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]);
|
||||
|
||||
if (verifyResult)//验证成功
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//请在这里加上商户的业务逻辑程序代码
|
||||
|
||||
|
||||
//——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
|
||||
//获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表
|
||||
|
||||
//商户订单号
|
||||
|
||||
string out_trade_no = Request.Form["out_trade_no"];
|
||||
|
||||
//支付宝交易号
|
||||
|
||||
string trade_no = Request.Form["trade_no"];
|
||||
|
||||
//交易状态
|
||||
string trade_status = Request.Form["trade_status"];
|
||||
|
||||
|
||||
if (Request.Form["trade_status"] == "TRADE_FINISHED")
|
||||
{
|
||||
//判断该笔订单是否在商户网站中已经做过处理
|
||||
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
|
||||
//如果有做过处理,不执行商户的业务程序
|
||||
|
||||
//注意:
|
||||
//该种交易状态只在两种情况下出现
|
||||
//1、开通了普通即时到账,买家付款成功后。
|
||||
//2、开通了高级即时到账,从该笔交易成功时间算起,过了签约时的可退款时限(如:三个月以内可退款、一年以内可退款等)后。
|
||||
Mtxfw.Model.user_Results_jl2 ReModel = daoResults2.GetModel(out_trade_no);
|
||||
if (ReModel != null)
|
||||
{
|
||||
if (ReModel.Seef == 0)
|
||||
{
|
||||
daoResults2.UpdateSeef("seef", 1, "seeftime", DateTime.Now, ReModel.Id);
|
||||
//增加买家余额
|
||||
daoUser.UpdateMoney("umoney12", ReModel.Addmoney, ReModel.MemberId);
|
||||
Mtxfw.Model.user_info uModel = new DAL.user_info().GetModel(ReModel.MemberId);
|
||||
if (uModel != null)
|
||||
{
|
||||
if (ReModel.OrdersIDs != "")
|
||||
{
|
||||
Double ZSubTotal = 0.00;
|
||||
string[] AOrderIDs = ReModel.OrdersIDs.Split(',');
|
||||
for (int i = 0; i < AOrderIDs.Length; i++)
|
||||
{
|
||||
Mtxfw.Model.order_info OrderModel = daoorder.GetModel(int.Parse(AOrderIDs[i]));
|
||||
if (OrderModel != null)
|
||||
{
|
||||
if (OrderModel.O_Payed == "" || OrderModel.O_Payed == "0")
|
||||
{
|
||||
ZSubTotal += OrderModel.Totalprice;
|
||||
}
|
||||
}
|
||||
}
|
||||
Double umoney12 = Convert.ToDouble((uModel.umoney12 - uModel.umoney22).ToString("f2"));
|
||||
ZSubTotal = Convert.ToDouble(ZSubTotal.ToString("f2"));
|
||||
if (ZSubTotal > 0.00 && ZSubTotal <= umoney12)
|
||||
{
|
||||
for (int i = 0; i < AOrderIDs.Length; i++)
|
||||
{
|
||||
Mtxfw.Model.order_info OrderModel = daoorder.GetModel(int.Parse(AOrderIDs[i]));
|
||||
if (OrderModel != null)
|
||||
{
|
||||
if (OrderModel.O_Payed == "" || OrderModel.O_Payed == "0")
|
||||
{
|
||||
daoorder.UpdateqyState(0, "1", DateTime.Now, OrderModel.Id);
|
||||
Mtxfw.DAL.MemberStatistics.JiangLiFP(OrderModel.Id, OrderModel.orderid, OrderModel.pid.ToString(), OrderModel.UserID, OrderModel.Totalprice, OrderModel.Totalprice0, OrderModel.Totalprice1, OrderModel.Totalprice2, OrderModel.utype.ToString());
|
||||
System.Data.DataSet Ds_op = new Mtxfw.DAL.order_product_info().GetList("", "utype='0' And orderid=" + OrderModel.Id + " Order By SubmitTime asc");
|
||||
if (Ds_op.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
for (int l = 0; l < Ds_op.Tables[0].Rows.Count; l++)
|
||||
{
|
||||
int P_pid = int.Parse(Ds_op.Tables[0].Rows[l]["pid"].ToString());
|
||||
int P_Totalnum = int.Parse(Ds_op.Tables[0].Rows[l]["Totalnum"].ToString());
|
||||
new Mtxfw.DAL.P_Product().UpdateInventory(P_pid, -P_Totalnum);
|
||||
}
|
||||
}
|
||||
Ds_op.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Double money = ZSubTotal;
|
||||
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
||||
mjl2.MemberId = ReModel.MemberId;
|
||||
mjl2.MemberId2 = 0;
|
||||
mjl2.Addmoney = 0;
|
||||
mjl2.Cutmoney = -money;
|
||||
mjl2.Totalmoney = umoney12 - money;
|
||||
mjl2.addtime = DateTime.Now;
|
||||
mjl2.BZContent = "购买商品付款";
|
||||
mjl2.PayID = "";
|
||||
mjl2.OrdersIDs = "";
|
||||
mjl2.OrdersID = 0;
|
||||
mjl2.utype = 2;
|
||||
mjl2.utype2 = 0;
|
||||
mjl2.Seef = 1;
|
||||
mjl2.seeftime = DateTime.Now;
|
||||
new DAL.user_Results_jl2().Add(mjl2);
|
||||
daoUser.UpdateMoney("umoney22", money, ReModel.MemberId);
|
||||
/*try
|
||||
{
|
||||
if (System.Text.RegularExpressions.Regex.IsMatch(uModel.Phone, @"^[1]+[3,4,5,6,7,8]+\d{9}"))
|
||||
{
|
||||
string strContent = "";
|
||||
strContent += "尊敬的用户(" + uModel.RealName + "),您好!您的订单已经支付成功,请登录网站查看详情!【荞宝商城】";
|
||||
Mtxfw.Utility.Common.sendsms(uModel.Phone, strContent);
|
||||
strContent = "";
|
||||
strContent += "用户(" + uModel.RealName + ")在(" + ReModel.addtime.ToString("yyyy年MM月dd日hh时mm分", DateTimeFormatInfo.InvariantInfo) + ")通过微信支付(" + money.ToString("f0") + ")元,请登录网站后台查看详情!【荞宝商城】";
|
||||
Mtxfw.Utility.Common.sendsms(uModel.Phone, strContent);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/weixinsentsms.txt", err.Message + err.ToString());
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/payerr.txt", out_trade_no);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Request.Form["trade_status"] == "TRADE_SUCCESS")
|
||||
{
|
||||
//判断该笔订单是否在商户网站中已经做过处理
|
||||
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
|
||||
//如果有做过处理,不执行商户的业务程序
|
||||
|
||||
//注意:
|
||||
//该种交易状态只在一种情况下出现——开通了高级即时到账,买家付款成功后。
|
||||
Mtxfw.Model.user_Results_jl2 ReModel = daoResults2.GetModel(out_trade_no);
|
||||
if (ReModel != null)
|
||||
{
|
||||
if (ReModel.Seef == 0)
|
||||
{
|
||||
daoResults2.UpdateSeef("seef", 1, "seeftime", DateTime.Now, ReModel.Id);
|
||||
//增加买家余额
|
||||
daoUser.UpdateMoney("umoney12", ReModel.Addmoney, ReModel.MemberId);
|
||||
Mtxfw.Model.user_info uModel = new DAL.user_info().GetModel(ReModel.MemberId);
|
||||
if (uModel != null)
|
||||
{
|
||||
if (ReModel.OrdersIDs != "")
|
||||
{
|
||||
Double ZSubTotal = 0.00;
|
||||
string[] AOrderIDs = ReModel.OrdersIDs.Split(',');
|
||||
for (int i = 0; i < AOrderIDs.Length; i++)
|
||||
{
|
||||
Mtxfw.Model.order_info OrderModel = daoorder.GetModel(int.Parse(AOrderIDs[i]));
|
||||
if (OrderModel != null)
|
||||
{
|
||||
if (OrderModel.O_Payed == "" || OrderModel.O_Payed == "0")
|
||||
{
|
||||
ZSubTotal += OrderModel.Totalprice;
|
||||
}
|
||||
}
|
||||
}
|
||||
Double umoney12 = Convert.ToDouble((uModel.umoney12 - uModel.umoney22).ToString("f2"));
|
||||
ZSubTotal = Convert.ToDouble(ZSubTotal.ToString("f2"));
|
||||
if (ZSubTotal > 0.00 && ZSubTotal <= umoney12)
|
||||
{
|
||||
for (int i = 0; i < AOrderIDs.Length; i++)
|
||||
{
|
||||
Mtxfw.Model.order_info OrderModel = daoorder.GetModel(int.Parse(AOrderIDs[i]));
|
||||
if (OrderModel != null)
|
||||
{
|
||||
if (OrderModel.O_Payed == "" || OrderModel.O_Payed == "0")
|
||||
{
|
||||
daoorder.UpdateqyState(0, "1", DateTime.Now, OrderModel.Id);
|
||||
Mtxfw.DAL.MemberStatistics.JiangLiFP(OrderModel.Id, OrderModel.orderid, OrderModel.pid.ToString(), OrderModel.UserID, OrderModel.Totalprice, OrderModel.Totalprice0, OrderModel.Totalprice1, OrderModel.Totalprice2, OrderModel.utype.ToString());
|
||||
System.Data.DataSet Ds_op = new Mtxfw.DAL.order_product_info().GetList("", "utype='0' And orderid=" + OrderModel.Id + " Order By SubmitTime asc");
|
||||
if (Ds_op.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
for (int l = 0; l < Ds_op.Tables[0].Rows.Count; l++)
|
||||
{
|
||||
int P_pid = int.Parse(Ds_op.Tables[0].Rows[l]["pid"].ToString());
|
||||
int P_Totalnum = int.Parse(Ds_op.Tables[0].Rows[l]["Totalnum"].ToString());
|
||||
new Mtxfw.DAL.P_Product().UpdateInventory(P_pid, -P_Totalnum);
|
||||
}
|
||||
}
|
||||
Ds_op.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Double money = ZSubTotal;
|
||||
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
||||
mjl2.MemberId = ReModel.MemberId;
|
||||
mjl2.MemberId2 = 0;
|
||||
mjl2.Addmoney = 0;
|
||||
mjl2.Cutmoney = -money;
|
||||
mjl2.Totalmoney = umoney12 - money;
|
||||
mjl2.addtime = DateTime.Now;
|
||||
mjl2.BZContent = "购买商品付款";
|
||||
mjl2.PayID = "";
|
||||
mjl2.OrdersIDs = "";
|
||||
mjl2.OrdersID = 0;
|
||||
mjl2.utype = 2;
|
||||
mjl2.utype2 = 0;
|
||||
mjl2.Seef = 1;
|
||||
mjl2.seeftime = DateTime.Now;
|
||||
new DAL.user_Results_jl2().Add(mjl2);
|
||||
daoUser.UpdateMoney("umoney22", money, ReModel.MemberId);
|
||||
/*try
|
||||
{
|
||||
if (System.Text.RegularExpressions.Regex.IsMatch(uModel.Phone, @"^[1]+[3,4,5,6,7,8]+\d{9}"))
|
||||
{
|
||||
string strContent = "";
|
||||
strContent += "尊敬的用户(" + uModel.RealName + "),您好!您的订单已经支付成功,请登录网站查看详情!【荞宝商城】";
|
||||
Mtxfw.Utility.Common.sendsms(uModel.Phone, strContent);
|
||||
strContent = "";
|
||||
strContent += "用户(" + uModel.RealName + ")在(" + ReModel.addtime.ToString("yyyy年MM月dd日hh时mm分", DateTimeFormatInfo.InvariantInfo) + ")通过微信支付(" + money.ToString("f0") + ")元,请登录网站后台查看详情!【荞宝商城】";
|
||||
Mtxfw.Utility.Common.sendsms(uModel.Phone, strContent);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/weixinsentsms.txt", err.Message + err.ToString());
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/payerr.txt", out_trade_no);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
|
||||
|
||||
Response.Write("success"); //请不要修改或删除
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
else//验证失败
|
||||
{
|
||||
Response.Write("fail");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Write("无通知参数");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取支付宝POST过来通知消息,并以“参数名=参数值”的形式组成数组
|
||||
/// </summary>
|
||||
/// <returns>request回来的信息组成的数组</returns>
|
||||
public SortedDictionary<string, string> GetRequestPost()
|
||||
{
|
||||
int i = 0;
|
||||
SortedDictionary<string, string> sArray = new SortedDictionary<string, string>();
|
||||
NameValueCollection coll;
|
||||
//Load Form variables into NameValueCollection variable.
|
||||
coll = Request.Form;
|
||||
|
||||
// Get names of all forms into a string array.
|
||||
String[] requestItem = coll.AllKeys;
|
||||
|
||||
for (i = 0; i < requestItem.Length; i++)
|
||||
{
|
||||
sArray.Add(requestItem[i], Request.Form[requestItem[i]]);
|
||||
}
|
||||
|
||||
return sArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Mtxfw.shop/pay/notify_url.aspx.designer.cs
generated
Normal file
15
Mtxfw.shop/pay/notify_url.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Mtxfw.shop {
|
||||
|
||||
|
||||
public partial class notify_url {
|
||||
}
|
||||
}
|
||||
15
Mtxfw.shop/pay/return_url.aspx
Normal file
15
Mtxfw.shop/pay/return_url.aspx
Normal file
@@ -0,0 +1,15 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" Inherits="Mtxfw.shop.return_url" Codebehind="return_url.aspx.cs" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" >
|
||||
<head runat="server">
|
||||
<title>页面跳转同步通知页面</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<a href="/Member_Mybalance.aspx">进入我的账户</a>
|
||||
<a href="/Member_Orders_List.aspx">查看订单</a>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
209
Mtxfw.shop/pay/return_url.aspx.cs
Normal file
209
Mtxfw.shop/pay/return_url.aspx.cs
Normal file
@@ -0,0 +1,209 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
namespace Mtxfw.shop
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 功能:页面跳转同步通知页面
|
||||
/// 版本:3.3
|
||||
/// 日期:2012-07-10
|
||||
/// 说明:
|
||||
/// 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
/// 该代码仅供学习和研究支付宝接口使用,只是提供一个参考。
|
||||
///
|
||||
/// ///////////////////////页面功能说明///////////////////////
|
||||
/// 该页面可在本机电脑测试
|
||||
/// 可放入HTML等美化页面的代码、商户业务逻辑程序代码
|
||||
/// 该页面可以使用ASP.NET开发工具调试,也可以使用写文本函数LogResult进行调试
|
||||
/// </summary>
|
||||
|
||||
public partial class return_url : System.Web.UI.Page
|
||||
{
|
||||
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||||
Mtxfw.DAL.order_info daoorder = new Mtxfw.DAL.order_info();
|
||||
Mtxfw.DAL.user_Results_jl2 daoResults2 = new Mtxfw.DAL.user_Results_jl2();
|
||||
Mtxfw.DAL.order_product_info daoorderproduct = new Mtxfw.DAL.order_product_info();
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
SortedDictionary<string, string> sPara = GetRequestGet();
|
||||
|
||||
if (sPara.Count > 0)//判断是否有带返回参数
|
||||
{
|
||||
Mtxfw.Utility.Notify aliNotify = new Mtxfw.Utility.Notify();
|
||||
bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]);
|
||||
|
||||
if (verifyResult)//验证成功
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//请在这里加上商户的业务逻辑程序代码
|
||||
|
||||
|
||||
//——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
|
||||
//获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
|
||||
|
||||
//商户订单号
|
||||
|
||||
string out_trade_no = Request.QueryString["out_trade_no"];
|
||||
|
||||
//支付宝交易号
|
||||
|
||||
string trade_no = Request.QueryString["trade_no"];
|
||||
|
||||
//交易状态
|
||||
string trade_status = Request.QueryString["trade_status"];
|
||||
|
||||
|
||||
if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS")
|
||||
{
|
||||
//判断该笔订单是否在商户网站中已经做过处理
|
||||
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
|
||||
//如果有做过处理,不执行商户的业务程序
|
||||
|
||||
Mtxfw.Model.user_Results_jl2 ReModel = daoResults2.GetModel(out_trade_no);
|
||||
if (ReModel != null)
|
||||
{
|
||||
if (ReModel.Seef == 0)
|
||||
{
|
||||
daoResults2.UpdateSeef("seef", 1, "seeftime", DateTime.Now, ReModel.Id);
|
||||
//增加买家余额
|
||||
daoUser.UpdateMoney("umoney12", ReModel.Addmoney, ReModel.MemberId);
|
||||
Mtxfw.Model.user_info uModel = new DAL.user_info().GetModel(ReModel.MemberId);
|
||||
if (uModel != null)
|
||||
{
|
||||
if (ReModel.OrdersIDs != "")
|
||||
{
|
||||
Double ZSubTotal = 0.00;
|
||||
string[] AOrderIDs = ReModel.OrdersIDs.Split(',');
|
||||
for (int i = 0; i < AOrderIDs.Length; i++)
|
||||
{
|
||||
Mtxfw.Model.order_info OrderModel = daoorder.GetModel(int.Parse(AOrderIDs[i]));
|
||||
if (OrderModel != null)
|
||||
{
|
||||
if (OrderModel.O_Payed == "" || OrderModel.O_Payed == "0")
|
||||
{
|
||||
ZSubTotal += OrderModel.Totalprice;
|
||||
}
|
||||
}
|
||||
}
|
||||
Double umoney12 = Convert.ToDouble((uModel.umoney12 - uModel.umoney22).ToString("f2"));
|
||||
ZSubTotal = Convert.ToDouble(ZSubTotal.ToString("f2"));
|
||||
if (ZSubTotal > 0.00 && ZSubTotal <= umoney12)
|
||||
{
|
||||
for (int i = 0; i < AOrderIDs.Length; i++)
|
||||
{
|
||||
Mtxfw.Model.order_info OrderModel = daoorder.GetModel(int.Parse(AOrderIDs[i]));
|
||||
if (OrderModel != null)
|
||||
{
|
||||
if (OrderModel.O_Payed == "" || OrderModel.O_Payed == "0")
|
||||
{
|
||||
daoorder.UpdateqyState(0, "1", DateTime.Now, OrderModel.Id);
|
||||
Mtxfw.DAL.MemberStatistics.JiangLiFP(OrderModel.Id, OrderModel.orderid, OrderModel.pid.ToString(), OrderModel.UserID, OrderModel.Totalprice, OrderModel.Totalprice0, OrderModel.Totalprice1, OrderModel.Totalprice2, OrderModel.utype.ToString());
|
||||
System.Data.DataSet Ds_op = new Mtxfw.DAL.order_product_info().GetList("", "utype='0' And orderid=" + OrderModel.Id + " Order By SubmitTime asc");
|
||||
if (Ds_op.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
for (int l = 0; l < Ds_op.Tables[0].Rows.Count; l++)
|
||||
{
|
||||
int P_pid = int.Parse(Ds_op.Tables[0].Rows[l]["pid"].ToString());
|
||||
int P_Totalnum = int.Parse(Ds_op.Tables[0].Rows[l]["Totalnum"].ToString());
|
||||
new Mtxfw.DAL.P_Product().UpdateInventory(P_pid, -P_Totalnum);
|
||||
}
|
||||
}
|
||||
Ds_op.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Double money = ZSubTotal;
|
||||
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
||||
mjl2.MemberId = ReModel.MemberId;
|
||||
mjl2.MemberId2 = 0;
|
||||
mjl2.Addmoney = 0;
|
||||
mjl2.Cutmoney = -money;
|
||||
mjl2.Totalmoney = umoney12 - money;
|
||||
mjl2.addtime = DateTime.Now;
|
||||
mjl2.BZContent = "购买商品付款";
|
||||
mjl2.PayID = "";
|
||||
mjl2.OrdersIDs = "";
|
||||
mjl2.OrdersID = 0;
|
||||
mjl2.utype = 2;
|
||||
mjl2.utype2 = 0;
|
||||
mjl2.Seef = 1;
|
||||
mjl2.seeftime = DateTime.Now;
|
||||
new DAL.user_Results_jl2().Add(mjl2);
|
||||
daoUser.UpdateMoney("umoney22", money, ReModel.MemberId);
|
||||
/*try
|
||||
{
|
||||
if (System.Text.RegularExpressions.Regex.IsMatch(uModel.Phone, @"^[1]+[3,4,5,6,7,8]+\d{9}"))
|
||||
{
|
||||
string strContent = "";
|
||||
strContent += "尊敬的用户(" + uModel.RealName + "),您好!您的订单已经支付成功,请登录网站查看详情!【荞宝商城】";
|
||||
Mtxfw.Utility.Common.sendsms(uModel.Phone, strContent);
|
||||
strContent = "";
|
||||
strContent += "用户(" + uModel.RealName + ")在(" + ReModel.addtime.ToString("yyyy年MM月dd日hh时mm分", DateTimeFormatInfo.InvariantInfo) + ")通过微信支付(" + money.ToString("f0") + ")元,请登录网站后台查看详情!【荞宝商城】";
|
||||
Mtxfw.Utility.Common.sendsms(uModel.Phone, strContent);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/weixinsentsms.txt", err.Message + err.ToString());
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/payerr.txt", out_trade_no);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
else//验证失败
|
||||
{
|
||||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('验证失败');</script>");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('无返回参数');</script>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取支付宝GET过来通知消息,并以“参数名=参数值”的形式组成数组
|
||||
/// </summary>
|
||||
/// <returns>request回来的信息组成的数组</returns>
|
||||
public SortedDictionary<string, string> GetRequestGet()
|
||||
{
|
||||
int i = 0;
|
||||
SortedDictionary<string, string> sArray = new SortedDictionary<string, string>();
|
||||
NameValueCollection coll;
|
||||
//Load Form variables into NameValueCollection variable.
|
||||
coll = Request.QueryString;
|
||||
|
||||
// Get names of all forms into a string array.
|
||||
String[] requestItem = coll.AllKeys;
|
||||
|
||||
for (i = 0; i < requestItem.Length; i++)
|
||||
{
|
||||
sArray.Add(requestItem[i], Request.QueryString[requestItem[i]]);
|
||||
}
|
||||
|
||||
return sArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Mtxfw.shop/pay/return_url.aspx.designer.cs
generated
Normal file
24
Mtxfw.shop/pay/return_url.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,24 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Mtxfw.shop {
|
||||
|
||||
|
||||
public partial class return_url {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
}
|
||||
}
|
||||
78
Mtxfw.shop/pay/wxpay.aspx
Normal file
78
Mtxfw.shop/pay/wxpay.aspx
Normal file
@@ -0,0 +1,78 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wxpay.aspx.cs" Inherits="Mtxfw.shop.wxpay" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head runat="server">
|
||||
<title></title>
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
|
||||
<script src="http://res.mail.qq.com/mmr/static/lib/js/jquery.js" type="text/javascript"></script>
|
||||
<script src="http://res.mail.qq.com/mmr/static/lib/js/lazyloadv3.js" type="text/javascript"></script>
|
||||
<meta id="viewport" name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1; user-scalable=no;" />
|
||||
<style type="text/css">
|
||||
.ulbox{float:left;width:100%; margin:0;}
|
||||
.ulbox ul{float:left;width:100%;margin:0; list-style-type:none;}
|
||||
.ulbox ul li{float:left;width:100%; line-height:40px; height:40px;}
|
||||
.needMoney_Purple
|
||||
{
|
||||
margin:0 auto;
|
||||
width:125px;
|
||||
height:35px;
|
||||
display:inline-block;display:-moz-inline-stack;zoom:1;*display:inline;
|
||||
background-color:#ff4a00;
|
||||
line-height:35px;
|
||||
font-size:16px;
|
||||
text-align:center;
|
||||
color:#fff;
|
||||
font-weight:bold;
|
||||
cursor:pointer;
|
||||
border:0;
|
||||
-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form runat="server">
|
||||
<input type="hidden" name="hidBillID" value="" id="hidBillID" runat="server" />
|
||||
<script type="text/javascript">
|
||||
// 当微信内置浏览器完成内部初始化后会触发WeixinJSBridgeReady事件。
|
||||
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
|
||||
WeixinJSBridge.invoke('getBrandWCPayRequest', <%=wx_packageValue %>
|
||||
, function (res) {
|
||||
|
||||
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
||||
location.replace("/wxpayreturn_url.aspx?bill="+$("#hidBill").val());
|
||||
}else{
|
||||
$(".ulbox").show();
|
||||
//alert(res.err_msg);
|
||||
}
|
||||
// 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
|
||||
//因此微信团队建议,当收到ok返回时,向商户后台询问是否收到交易成功的通知,若收到通知,前端展示交易成功的界面;若此时未收到通知,商户后台主动调用查询订单接口,查询订单的当前状态,并反馈给前端展示相应的界面。
|
||||
});
|
||||
//公众号支付
|
||||
jQuery('a#getBrandWCPayRequest').click(function (e) {
|
||||
//alert("<%=wx_packageValue %>");
|
||||
$(".ulbox").hide();
|
||||
WeixinJSBridge.invoke('getBrandWCPayRequest', <%=wx_packageValue %>
|
||||
, function (res) {
|
||||
|
||||
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
||||
location.replace("/wxpayreturn_url.aspx?bill="+$("#hidBill").val());
|
||||
}else{
|
||||
$(".ulbox").show();
|
||||
}
|
||||
// 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
|
||||
//因此微信团队建议,当收到ok返回时,向商户后台询问是否收到交易成功的通知,若收到通知,前端展示交易成功的界面;若此时未收到通知,商户后台主动调用查询订单接口,查询订单的当前状态,并反馈给前端展示相应的界面。
|
||||
});
|
||||
});
|
||||
}, false)
|
||||
|
||||
</script>
|
||||
<div class="ulbox" style=" display:none;">
|
||||
<ul>
|
||||
<li>您需要支付¥<span style=" color:Red; font-size:16px; font-weight:bold;"><asp:Label ID="paybill" runat="server"></asp:Label></span>元</li>
|
||||
<li><a id="getBrandWCPayRequest" href="javascript:void(0);" class="needMoney_Purple">确认支付</a></li>
|
||||
<li><a href="/Member_Orders_List.aspx" class="needMoney_Purple">查看订单</a> <a href="/" class="needMoney_Purple">返回首页</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
192
Mtxfw.shop/pay/wxpay.aspx.cs
Normal file
192
Mtxfw.shop/pay/wxpay.aspx.cs
Normal file
@@ -0,0 +1,192 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Text;
|
||||
namespace Mtxfw.shop
|
||||
{
|
||||
public partial class wxpay : System.Web.UI.Page
|
||||
{
|
||||
protected string wx_packageValue = "";
|
||||
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config();
|
||||
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||||
private string appKey = "";
|
||||
private string appSecret = "";
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
try
|
||||
{
|
||||
appKey = config.webappKey;
|
||||
appSecret = config.webappSecret;
|
||||
string strBillNo = Mtxfw.Utility.Interface_WxPay.getTimestamp();
|
||||
string strWeixin_OpenID = "";
|
||||
|
||||
if (Request.QueryString["code"] != null)
|
||||
{
|
||||
|
||||
string code = Request.QueryString["code"].ToString();
|
||||
WXaccess_token ac = getgzptaccess_token(code, appKey, appSecret);
|
||||
strWeixin_OpenID = ac.openid;
|
||||
string strWeixin_Token = ac.access_token;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//Response.Redirect(Mtxfw.Utility.Interface_WxPay.OAuth2_GetUrl_Pay(Request.RawUrl.ToString(), 1));
|
||||
Getcode("http://shop.q-b.cc" + Request.RawUrl.ToString(), appKey);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(Request["je"]) && !String.IsNullOrEmpty(Request["t"]) && !String.IsNullOrEmpty(Request["billbo"]) && strWeixin_OpenID != "")
|
||||
{
|
||||
string strbody = "在线充值";
|
||||
strBillNo = Request["billbo"].ToString();
|
||||
paybill.Text = Request["je"].ToString();
|
||||
if (Request["t"].ToString() == "1")
|
||||
{
|
||||
strbody = "在线支付";
|
||||
}
|
||||
hidBillID.Value = strBillNo;
|
||||
|
||||
string _Pay_Package = Mtxfw.Utility.Interface_WxPay.Get_RequestHtml(HttpContext.Current, strWeixin_OpenID, strBillNo, Convert.ToDecimal(Request["je"].ToString()), strbody, "Card_Store");
|
||||
|
||||
//Mtxfw.Utility.Common.WriteHtml("/weixin/weixin.xml", _Pay_Package);
|
||||
//微信jspai支付
|
||||
if (_Pay_Package.Length > 0)
|
||||
{
|
||||
wx_packageValue = _Pay_Package;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/weixin0.txt", err.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取未授权的临时令牌
|
||||
/// </summary>
|
||||
private void Getcode(string strurl, string appID)
|
||||
{
|
||||
string url = "https://open.weixin.qq.com/connect/oauth2/authorize";
|
||||
string[] parameters ={
|
||||
"appid="+appID,
|
||||
"redirect_uri=" + UrlEncode(strurl),
|
||||
"response_type=code",
|
||||
"scope=snsapi_userinfo",
|
||||
"#wechat_redirect"
|
||||
|
||||
};
|
||||
string tempParameters = string.Empty;
|
||||
for (int i = 0; i < parameters.Length; i++)
|
||||
{
|
||||
if (i != parameters.Length - 1)
|
||||
{
|
||||
tempParameters += parameters[i] + "&";
|
||||
}
|
||||
else
|
||||
{
|
||||
tempParameters += parameters[i] + "";
|
||||
}
|
||||
}
|
||||
url = url + "?" + tempParameters + "";
|
||||
Response.Redirect(url);
|
||||
//ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>top.location='" + url + "';</script>");
|
||||
}
|
||||
/// <summary>
|
||||
/// url编码
|
||||
/// </summary>
|
||||
/// <param name="value">The value to Url encode</param>
|
||||
/// <returns>Returns a Url encoded string</returns>
|
||||
private string UrlEncode(string value)
|
||||
{
|
||||
string unreservedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
|
||||
StringBuilder result = new StringBuilder();
|
||||
foreach (char symbol in value)
|
||||
{
|
||||
if (unreservedChars.IndexOf(symbol) != -1)
|
||||
{
|
||||
result.Append(symbol);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Append('%' + String.Format("{0:X2}", (int)symbol));
|
||||
}
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
public object FromJson2(string json)
|
||||
{
|
||||
JavaScriptSerializer js = new JavaScriptSerializer();
|
||||
return js.Deserialize<WXaccess_token>(json);
|
||||
}
|
||||
public WXaccess_token getgzptaccess_token(string code, string appID, string appSecret)
|
||||
{
|
||||
WXaccess_token ac = null;
|
||||
string[] Aaccess = new string[2];
|
||||
string straccess_token = "";
|
||||
if (Session["gzptaccess_token"] == null)
|
||||
{
|
||||
string str = Mtxfw.Utility.Common.getPage2("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + appID + "&secret=" + appSecret + "&code=" + code + "&grant_type=authorization_code", "", "utf-8");
|
||||
if (str.IndexOf("openid") != -1)
|
||||
{
|
||||
ac = (WXaccess_token)FromJson2(str);
|
||||
Session["gzptaccess_token"] = ac.access_token + "|" + ac.openid + "|" + DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect("/login.aspx?Error=appid|" + appID + "|secret" + appSecret + "|code" + code + "");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] atoken = Session["gzptaccess_token"].ToString().Split('|');
|
||||
if (atoken.Length > 2)
|
||||
{
|
||||
bool b = true;
|
||||
if (atoken[2] != "")
|
||||
{
|
||||
DateTime dt = Convert.ToDateTime(atoken[2]);
|
||||
DateTime dt1 = DateTime.Now;
|
||||
DateTime dt2 = dt.AddSeconds(7000);
|
||||
if (DateTime.Compare(dt2, dt1) < 0)
|
||||
{
|
||||
b = false;
|
||||
|
||||
}
|
||||
}
|
||||
if (b)
|
||||
{
|
||||
straccess_token = atoken[0];
|
||||
ac = new WXaccess_token();
|
||||
ac.access_token = atoken[0];
|
||||
ac.openid = atoken[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
string str = Mtxfw.Utility.Common.getPage2("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + appID + "&secret=" + appSecret + "&code=" + code + "&grant_type=authorization_code", "", "utf-8");
|
||||
if (str.IndexOf("openid") != -1)
|
||||
{
|
||||
ac = (WXaccess_token)FromJson2(str);
|
||||
Session["gzptaccess_token"] = ac.access_token + "|" + ac.openid + "|" + DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect("/login.aspx?Error=openid" + str);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect("/login.aspx?Error=atoken" + atoken.Length);
|
||||
}
|
||||
}
|
||||
return ac;
|
||||
}
|
||||
}
|
||||
}
|
||||
42
Mtxfw.shop/pay/wxpay.aspx.designer.cs
generated
Normal file
42
Mtxfw.shop/pay/wxpay.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,42 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Mtxfw.shop {
|
||||
|
||||
|
||||
public partial class wxpay {
|
||||
|
||||
/// <summary>
|
||||
/// viewport 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlMeta viewport;
|
||||
|
||||
/// <summary>
|
||||
/// hidBillID 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlInputHidden hidBillID;
|
||||
|
||||
/// <summary>
|
||||
/// paybill 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label paybill;
|
||||
}
|
||||
}
|
||||
12
Mtxfw.shop/pay/wxpaynotify_url.aspx
Normal file
12
Mtxfw.shop/pay/wxpaynotify_url.aspx
Normal file
@@ -0,0 +1,12 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wxpaynotify_url.aspx.cs" Inherits="Mtxfw.shop.wxpaynotify_url" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
150
Mtxfw.shop/pay/wxpaynotify_url.aspx.cs
Normal file
150
Mtxfw.shop/pay/wxpaynotify_url.aspx.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Xml;
|
||||
using System.Globalization;
|
||||
namespace Mtxfw.shop
|
||||
{
|
||||
public partial class wxpaynotify_url : System.Web.UI.Page
|
||||
{
|
||||
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||||
Mtxfw.DAL.order_info daoorder = new Mtxfw.DAL.order_info();
|
||||
Mtxfw.DAL.user_Results_jl2 daoResults2 = new Mtxfw.DAL.user_Results_jl2();
|
||||
Mtxfw.DAL.order_product_info daoorderproduct = new Mtxfw.DAL.order_product_info();
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
string wxNotifyXml = "";
|
||||
|
||||
byte[] bytes = Request.BinaryRead(Request.ContentLength);
|
||||
wxNotifyXml = System.Text.Encoding.UTF8.GetString(bytes);
|
||||
|
||||
if (wxNotifyXml.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
XmlDocument xmldoc = new XmlDocument();
|
||||
|
||||
xmldoc.LoadXml(wxNotifyXml);
|
||||
|
||||
string ResultCode = xmldoc.SelectSingleNode("/xml/result_code").InnerText;
|
||||
string ReturnCode = xmldoc.SelectSingleNode("/xml/return_code").InnerText;
|
||||
|
||||
if (ReturnCode == "SUCCESS" && ResultCode == "SUCCESS")
|
||||
{
|
||||
//验证成功
|
||||
//取结果参数做业务处理
|
||||
string out_trade_no = xmldoc.SelectSingleNode("/xml/out_trade_no").InnerText;
|
||||
//财付通订单号
|
||||
string trade_no = xmldoc.SelectSingleNode("/xml/transaction_id").InnerText;
|
||||
//金额,以分为单位
|
||||
string total_fee = xmldoc.SelectSingleNode("/xml/total_fee").InnerText;
|
||||
|
||||
/********************************
|
||||
*
|
||||
* 自己业务处理
|
||||
*
|
||||
*********************************/
|
||||
Mtxfw.Model.user_Results_jl2 ReModel = daoResults2.GetModel(out_trade_no);
|
||||
if (ReModel != null)
|
||||
{
|
||||
if (ReModel.Seef == 0)
|
||||
{
|
||||
daoResults2.UpdateSeef("seef", 1, "seeftime", DateTime.Now, ReModel.Id);
|
||||
//增加买家余额
|
||||
daoUser.UpdateMoney("umoney12", ReModel.Addmoney, ReModel.MemberId);
|
||||
Mtxfw.Model.user_info uModel = new DAL.user_info().GetModel(ReModel.MemberId);
|
||||
if (uModel != null)
|
||||
{
|
||||
if (ReModel.OrdersIDs != "")
|
||||
{
|
||||
Double ZSubTotal = 0.00;
|
||||
string[] AOrderIDs = ReModel.OrdersIDs.Split(',');
|
||||
for (int i = 0; i < AOrderIDs.Length; i++)
|
||||
{
|
||||
Mtxfw.Model.order_info OrderModel = daoorder.GetModel(int.Parse(AOrderIDs[i]));
|
||||
if (OrderModel != null)
|
||||
{
|
||||
if (OrderModel.O_Payed == "" || OrderModel.O_Payed == "0")
|
||||
{
|
||||
ZSubTotal += OrderModel.Totalprice;
|
||||
}
|
||||
}
|
||||
}
|
||||
Double umoney12 = Convert.ToDouble((uModel.umoney12 - uModel.umoney22).ToString("f2"));
|
||||
ZSubTotal = Convert.ToDouble(ZSubTotal.ToString("f2"));
|
||||
if (ZSubTotal > 0.00 && ZSubTotal <= umoney12)
|
||||
{
|
||||
for (int i = 0; i < AOrderIDs.Length; i++)
|
||||
{
|
||||
Mtxfw.Model.order_info OrderModel = daoorder.GetModel(int.Parse(AOrderIDs[i]));
|
||||
if (OrderModel != null)
|
||||
{
|
||||
if (OrderModel.O_Payed == "" || OrderModel.O_Payed == "0")
|
||||
{
|
||||
daoorder.UpdateqyState(0, "1", DateTime.Now, OrderModel.Id);
|
||||
Mtxfw.DAL.MemberStatistics.JiangLiFP(OrderModel.Id, OrderModel.orderid, OrderModel.pid.ToString(), OrderModel.UserID, OrderModel.Totalprice, OrderModel.Totalprice0, OrderModel.Totalprice1, OrderModel.Totalprice2, OrderModel.utype.ToString());
|
||||
System.Data.DataSet Ds_op = new Mtxfw.DAL.order_product_info().GetList("", "utype='0' And orderid=" + OrderModel.Id + " Order By SubmitTime asc");
|
||||
if (Ds_op.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
for (int l = 0; l < Ds_op.Tables[0].Rows.Count; l++)
|
||||
{
|
||||
int P_pid = int.Parse(Ds_op.Tables[0].Rows[l]["pid"].ToString());
|
||||
int P_Totalnum = int.Parse(Ds_op.Tables[0].Rows[l]["Totalnum"].ToString());
|
||||
new Mtxfw.DAL.P_Product().UpdateInventory(P_pid, -P_Totalnum);
|
||||
}
|
||||
}
|
||||
Ds_op.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Double money = ZSubTotal;
|
||||
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
||||
mjl2.MemberId = ReModel.MemberId;
|
||||
mjl2.MemberId2 = 0;
|
||||
mjl2.Addmoney = 0;
|
||||
mjl2.Cutmoney = -money;
|
||||
mjl2.Totalmoney = umoney12 - money;
|
||||
mjl2.addtime = DateTime.Now;
|
||||
mjl2.BZContent = "购买商品付款";
|
||||
mjl2.PayID = "";
|
||||
mjl2.OrdersIDs = "";
|
||||
mjl2.OrdersID = 0;
|
||||
mjl2.utype = 2;
|
||||
mjl2.utype2 = 0;
|
||||
mjl2.Seef = 1;
|
||||
mjl2.seeftime = DateTime.Now;
|
||||
new DAL.user_Results_jl2().Add(mjl2);
|
||||
daoUser.UpdateMoney("umoney22", money, ReModel.MemberId);
|
||||
/*try
|
||||
{
|
||||
if (System.Text.RegularExpressions.Regex.IsMatch(uModel.Phone, @"^[1]+[3,4,5,6,7,8]+\d{9}"))
|
||||
{
|
||||
string strContent = "";
|
||||
strContent += "尊敬的用户(" + uModel.RealName + "),您好!您的订单已经支付成功,请登录网站查看详情!【荞宝商城】";
|
||||
Mtxfw.Utility.Common.sendsms(uModel.Phone, strContent);
|
||||
strContent = "";
|
||||
strContent += "用户(" + uModel.RealName + ")在(" + ReModel.addtime.ToString("yyyy年MM月dd日hh时mm分", DateTimeFormatInfo.InvariantInfo) + ")通过微信支付(" + money.ToString("f0") + ")元,请登录网站后台查看详情!【荞宝商城】";
|
||||
Mtxfw.Utility.Common.sendsms(uModel.Phone, strContent);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/weixinsentsms.txt", err.Message + err.ToString());
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/payerr.txt", out_trade_no);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Mtxfw.shop/pay/wxpaynotify_url.aspx.designer.cs
generated
Normal file
15
Mtxfw.shop/pay/wxpaynotify_url.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Mtxfw.shop {
|
||||
|
||||
|
||||
public partial class wxpaynotify_url {
|
||||
}
|
||||
}
|
||||
40
Mtxfw.shop/pay/wxpayreturn_url.aspx
Normal file
40
Mtxfw.shop/pay/wxpayreturn_url.aspx
Normal file
@@ -0,0 +1,40 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" Inherits="Mtxfw.shop.wxpayreturn_url" Codebehind="wxpayreturn_url.aspx.cs" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" >
|
||||
<head runat="server">
|
||||
<title>页面跳转同步通知页面</title>
|
||||
<style type="text/css">
|
||||
.ulbox{float:left;width:100%; margin:0;}
|
||||
.ulbox ul{float:left;width:100%;margin:0; list-style-type:none;}
|
||||
.ulbox ul li{float:left;width:100%; line-height:40px; height:40px;}
|
||||
.needMoney_Purple
|
||||
{
|
||||
margin:0 auto;
|
||||
width:125px;
|
||||
height:35px;
|
||||
display:inline-block;display:-moz-inline-stack;zoom:1;*display:inline;
|
||||
background-color:#ff4a00;
|
||||
line-height:35px;
|
||||
font-size:16px;
|
||||
text-align:center;
|
||||
color:#fff;
|
||||
font-weight:bold;
|
||||
cursor:pointer;
|
||||
border:0;
|
||||
-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<div class="ulbox">
|
||||
<ul>
|
||||
<li style=" color:Red;"><%=strqu %></li>
|
||||
<li><a href="/Member_Orders_List.aspx" class="needMoney_Purple">查看订单</a> <a href="/" class="needMoney_Purple">返回首页</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
93
Mtxfw.shop/pay/wxpayreturn_url.aspx.cs
Normal file
93
Mtxfw.shop/pay/wxpayreturn_url.aspx.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.Generic;
|
||||
namespace Mtxfw.shop
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 功能:页面跳转同步通知页面
|
||||
/// 版本:3.3
|
||||
/// 日期:2012-07-10
|
||||
/// 说明:
|
||||
/// 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
/// 该代码仅供学习和研究支付宝接口使用,只是提供一个参考。
|
||||
///
|
||||
/// ///////////////////////页面功能说明///////////////////////
|
||||
/// 该页面可在本机电脑测试
|
||||
/// 可放入HTML等美化页面的代码、商户业务逻辑程序代码
|
||||
/// 该页面可以使用ASP.NET开发工具调试,也可以使用写文本函数LogResult进行调试
|
||||
/// </summary>
|
||||
|
||||
public partial class wxpayreturn_url : System.Web.UI.Page
|
||||
{
|
||||
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||||
Mtxfw.DAL.order_info daoorder = new Mtxfw.DAL.order_info();
|
||||
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
|
||||
public string strqu = "您已经支付成功!";
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
if (!String.IsNullOrEmpty(Request.QueryString["bill"]))//验证成功
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//请在这里加上商户的业务逻辑程序代码
|
||||
|
||||
|
||||
//——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
|
||||
//获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
|
||||
|
||||
//商户订单号
|
||||
|
||||
string out_trade_no = Request.QueryString["bill"];
|
||||
|
||||
Mtxfw.Model.user_Results ReModel = daoResults.GetModel2(out_trade_no);
|
||||
if (ReModel != null)
|
||||
{
|
||||
strqu = "您已经支付成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
strqu = "操作可能有误,请查看您的订单是否已支付成功!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strqu = "支付失败,参数错误!";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取支付宝GET过来通知消息,并以“参数名=参数值”的形式组成数组
|
||||
/// </summary>
|
||||
/// <returns>request回来的信息组成的数组</returns>
|
||||
public SortedDictionary<string, string> GetRequestGet()
|
||||
{
|
||||
int i = 0;
|
||||
SortedDictionary<string, string> sArray = new SortedDictionary<string, string>();
|
||||
NameValueCollection coll;
|
||||
//Load Form variables into NameValueCollection variable.
|
||||
coll = Request.QueryString;
|
||||
|
||||
// Get names of all forms into a string array.
|
||||
String[] requestItem = coll.AllKeys;
|
||||
|
||||
for (i = 0; i < requestItem.Length; i++)
|
||||
{
|
||||
sArray.Add(requestItem[i], Request.QueryString[requestItem[i]]);
|
||||
}
|
||||
|
||||
return sArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Mtxfw.shop/pay/wxpayreturn_url.aspx.designer.cs
generated
Normal file
24
Mtxfw.shop/pay/wxpayreturn_url.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,24 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Mtxfw.shop {
|
||||
|
||||
|
||||
public partial class wxpayreturn_url {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user