SuLei.Web/api/payment/wxapipay/notify_url.aspx.cs

(开头部分) 7KB

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

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SuLei.API.Payment.wxpay;
using SuLei.Common;

namespace SuLei.Web.api.payment.wxapipay
{
    public partial class notify_url : System.Web.UI.Page
    {
        int site_payment_id = 0; //站点支付方式ID

        protected void Page_Load(object sender, EventArgs e)
        {
            new SuLei.BLL.sl_manager_log().Add(1, "", SLEnums.ActionEnum.Login.ToString(), "支付回调");
            WxPayData notifyData = JsApiPay.GetNotifyData(); //获取微信传过来的参数
            if (!notifyData.IsSet("transaction_id"))
            {
                //若transaction_id不存在,则立即返回结果给微信支付后台
                WxPayData res = new WxPayData();
                res.SetValue("return_code", "FAIL");
                res.SetValue("return_msg", "支付结果中微信订单号不存在");
                Response.Write(res.ToXml());
                return;
            }
            //获取订单信息
            string transaction_id = notifyData.GetValue("transaction_id").ToString(); //微信支付订单号
            string order_no = notifyData.GetValue("out_trade_no").ToString().ToUpper(); //商户订单号
            string total_fee = notifyData.GetValue("total_fee").ToString(); //获取总金额
            if (order_no.StartsWith("R")) //充值订单
            {
                site_payment_id = new BLL.user_recharge().GetPaymentId(order_no);
            }
            else if (order_no.StartsWith("B")) //商品订单
            {
                site_payment_id = new BLL.orders().GetPaymentId(order_no);
            }
            if (site_payment_id == 0)
            {
                //若订单查询失败,则立即返回结果给微信支付后台
                WxPayData res = new WxPayData();
                res.SetValue("return_code", "FAIL");
                res.SetValue("return_msg", "订单不存在或已删除");
                Response.Write(res.ToXml());
                return;
            }

            //查询订单,判断订单真实性
            if (!QueryOrder(transaction_id))
            {
                //若订单查询失败,则立即返回结果给微信支付后台
                WxPayData res = new WxPayData();
                res.SetValue("return_code", "FAIL");
                res.SetValue("return_msg", "订单查询失败");
                Response.Write(res.ToXml());
                return;
            }

后面还有 112 行代码,购买后查看完整代码

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

AI 解读 AI

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

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