TZ.Web/wxpay/ResultNotifyPage.aspx.cs

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using TZ.API;
using TZ.Model;
using TZ.BLL;
using TZ.Common;

public partial class wxpay_ResultNotifyPage : System.Web.UI.Page
{
    protected TZ.BLL.Orders bll = new TZ.BLL.Orders();
    protected void Page_Load(object sender, EventArgs e)
    {
        TZ.API.wxpay.ResultNotify resultNotify = new TZ.API.wxpay.ResultNotify(this);
        TZ.API.wxpay.WxPayData notifyData = resultNotify.ProcessNotify();
        if (!notifyData.IsSet("transaction_id"))
        {
            TZ.API.wxpay.Log.Error(this.GetType().ToString(), "The Pay result is error : FAIL");
        }
        else
        {
            string transaction_id = notifyData.GetValue("transaction_id").ToString();
            //查询订单,判断订单真实性
            if (!resultNotify.QueryOrder(transaction_id))
            {
                //若订单查询失败,则立即返回结果给微信支付后台
                TZ.API.wxpay.Log.Error(this.GetType().ToString(), "Order query failure : 订单查询失败");
            }
            //查询订单成功
            else
            {
                TZ.API.wxpay.Log.Error(this.GetType().ToString(), "order query success: SUCCESS");
                //订单号
                string order_no = notifyData.GetValue("out_trade_no").ToString();
                //交易号
                string trade_no = notifyData.GetValue("transaction_id").ToString();
                if (!string.IsNullOrEmpty(order_no) && !string.IsNullOrEmpty(trade_no))
                {
                    TZ.Model.Orders orders = bll.GetModel(order_no);
                    if (orders != null && orders.Id > 0)
                    {
                        if (orders.Payment_status == 1)
                        {
                            TZ.API.wxpay.Log.Info(this.GetType().ToString(), "订单支付状态已经处理成功!");
                        }
                        else
                        {
                            bool bl = bll.UpdateField(order_no, "payment_status=1,status=1,payment_time='" + DateTime.Now + "',trade_no='" + trade_no + "',confirm_time='" + DateTime.Now + "'");
                            if (bl)
                            {
                                //更新状态后从新查询订单
                                TZ.Model.Orders model = bll.GetModel(order_no);
                                //如果使用了优惠券,则更改优惠券状态
后面还有 114 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。