CmsWeb/api/wxpay/JsApiPayPage.aspx.cs

(开头部分) 3KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;



public partial class api_wxpay_JsApiPayPage : System.Web.UI.Page
{
    public static string wxJsApiParam { get; set; } //H5调起JS API参数
    public static string orderNum;
    protected void Page_Load(object sender, EventArgs e)
    {
        Log.Info(this.GetType().ToString(), "page load");
        if (!IsPostBack)
        {
            Cms.Model.C_user userModel = adminUser.GetuserLoginState();
            int otid = Convert.ToInt32(Request["orderid"].ToString());
            Cms.BLL.C_order otBll = new Cms.BLL.C_order();
            Cms.Model.C_order orderEntity = otBll.GetModel(otid);
            order_num.Text = orderEntity.order_num;
            litMoney.Text = Convert.ToDecimal(orderEntity.price_sum).ToString("0.00");
            litDate.Text = orderEntity.updateTime.ToString();
            string openid = userModel.openid.ToString();
            string total_fee = ((int)(Convert.ToDecimal(orderEntity.price_sum)* 100)).ToString();
            //检测是否给当前页面传递了相关参数
            if (string.IsNullOrEmpty(openid) || string.IsNullOrEmpty(total_fee))
            {
                Response.Write("<span style='color:#FF0000;font-size:20px'>" + "页面传参出错,请返回重试" + "</span>");
                Log.Error(this.GetType().ToString(), "This page have not get params, cannot be inited, exit...");
                submit.Visible = false;
                return;
            }

            //若传递了相关参数,则调统一下单接口,获得后续相关接口的入口参数
            JsApiPay jsApiPay = new JsApiPay(this);
            jsApiPay.openid = openid;
            jsApiPay.orderid = orderEntity.order_num;
            DataTable dt = new Cms.BLL.C_ordersub().GetList("order_id=" + orderEntity.id).Tables[0];
            if (dt != null && dt.Rows.Count > 0)
            {
                jsApiPay.productName = dt.Rows[0]["title"].ToString();
            }
            else
            {
                jsApiPay.productName = "泓源鼎盛酒业商品";
            }
            try
            {
            jsApiPay.total_fee = int.Parse(total_fee);
               

            //JSAPI支付预处理
           
                WxPayData unifiedOrderResult = jsApiPay.GetUnifiedOrderResult();
                 
                wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数 
后面还有 15 行代码,购买后查看完整代码

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

AI 解读 AI

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

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