コード例 #1
0
 public string shareLink = "";//sharelink
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         M_UserInfo mu = buser.GetLogin();
         pageMod = GetScenceMod();
         if (!B_Design_Helper.Se_CheckAccessPwd(pageMod, mu))
         {
             Server.Transfer("/design/h5/checkpwd.aspx?sid=" + Sid + "&ztype=ppt");
             return;
         }
         //shareLink = Request.Url.Host + "/h5/" + pageMod.ID;
         if (DeviceHelper.GetBrower() == DeviceHelper.Brower.Micro)
         {
             try
             {
                 //Avoid sometimes WeChat API parsing error
                 WX_Share.Visible = true;
                 //--WXAPI
                 WxAPI api = WxAPI.Code_Get();
                 appid     = api.AppId.APPID;
                 timeStamp = WxAPI.HP_GetTimeStamp();
                 sign      = api.JSAPI_GetSign(api.JSAPITicket, noncestr, timeStamp, Request.Url.AbsoluteUri);
             }
             catch (Exception ex) { ZLLog.L("wxerror:" + ex.Message); }
         }
         Title_L.Text = pageMod.Title;
         if (string.IsNullOrEmpty(pageMod.PreviewImg))
         {
             string[] defwx = "/UploadFiles/demo/h4.jpg|/UploadFiles/demo/h5.jpg".Split('|');
             pageMod.PreviewImg = defwx[new Random().Next(0, defwx.Length)];
         }
         Wx_Img.ImageUrl = pageMod.PreviewImg;
     }
 }
コード例 #2
0
ファイル: wxpay_mp.aspx.cs プロジェクト: zoomlacms/web047
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            appMod = WxPayApi.Pay_GetByID(AppID);

            siteurl = HttpUtility.UrlEncode(SiteConfig.SiteInfo.SiteUrl + "/Payonline/wxpay_mp.aspx?payno=" + PayNo + "&appid=" + AppID);
            //首次进入自动跳转获取支付code
            if (!State.Equals("redirect"))
            {
                string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appMod.Pay_APPID + "&redirect_uri=" + siteurl + "&response_type=code&scope=snsapi_userinfo&state=redirect#wechat_redirect";

                Response.Redirect(url);
            }

            timestr = WxAPI.HP_GetTimeStamp();
            WeiXinPay();
            string stringA        = "appId=" + appMod.Pay_APPID + "&nonceStr=" + WxAPI.nonce + "&package=prepay_id=" + prepay_id + "&signType=MD5&timeStamp=" + timestr;
            string stringSignTemp = stringA + "&key=" + appMod.Pay_Key;
            paySign = StringHelper.MD5(stringSignTemp).ToUpper();
        }
    }
コード例 #3
0
ファイル: wxpay_mp.aspx.cs プロジェクト: zoomlacms/web040
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                appMod = WxPayApi.Pay_GetByID(AppID);
                if (string.IsNullOrEmpty(appMod.APPID))
                {
                    throw new Exception("未设置APPID");
                }
                if (string.IsNullOrEmpty(appMod.Secret))
                {
                    throw new Exception("未指定Secret");
                }
                if (string.IsNullOrEmpty(appMod.Pay_AccountID))
                {
                    throw new Exception("未设置商户号");
                }
                if (string.IsNullOrEmpty(appMod.Pay_Key))
                {
                    throw new Exception("未设置支付Key");
                }

                //首次进入自动跳转获取支付code
                if (!State.Equals("redirect"))
                {
                    string siteurl = HttpUtility.UrlEncode(SiteConfig.SiteInfo.SiteUrl + "/PayOnline/wxpay_mp.aspx?payno=" + PayNo + "&appid=" + appMod.APPID + "&SuccessUrl=" + SuccessUrl);
                    string url     = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appMod.APPID + "&redirect_uri=" + siteurl + "&response_type=code&scope=snsapi_userinfo&state=redirect#wechat_redirect";
                    Response.Redirect(url);
                }
                WeiXinPay();//统一下单,并填充预付单号
                timestr = WxAPI.HP_GetTimeStamp();
                string stringA        = "appId=" + appMod.APPID + "&nonceStr=" + WxAPI.nonce + "&package=prepay_id=" + prepay_id + "&signType=MD5&timeStamp=" + timestr;
                string stringSignTemp = stringA + "&key=" + appMod.Pay_Key;
                paySign = StringHelper.MD5(stringSignTemp).ToUpper();
            }
        }
コード例 #4
0
ファイル: wxpay_mp.aspx.cs プロジェクト: zoomlacms/web043
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                B_WX_APPID wxBll  = new B_WX_APPID();
                B_Content  conBll = new B_Content();
                M_Payment  payMod = payBll.SelModelByPayNo(PayNo);
                if (payMod == null)
                {
                    function.WriteErrMsg("支付单不存在");
                }
                if (payMod.Status != (int)M_Payment.PayStatus.NoPay)
                {
                    function.WriteErrMsg("该订单不可付款");
                }
                M_OrderList orderMod = orderBll.SelModelByOrderNo(payMod.PaymentNum.Trim(','));
                if (orderMod.StoreID < 1)
                {
                    function.WriteErrMsg("订单未绑定店铺");
                }
                M_CommonData storeMod = conBll.SelReturnModel(orderMod.StoreID);
                if (storeMod == null)
                {
                    function.WriteErrMsg("店铺信息不存在");
                }
                appMod = wxBll.SelReturnModel(DataConverter.CLng(storeMod.SpecialID));
                if (appMod == null)
                {
                    function.WriteErrMsg("店铺未绑定微信");
                }
                //appMod = WxPayApi.Pay_GetByID(AppID);
                if (string.IsNullOrEmpty(appMod.APPID))
                {
                    throw new Exception("未设置APPID");
                }
                if (string.IsNullOrEmpty(appMod.Secret))
                {
                    throw new Exception("未指定Secret");
                }
                if (string.IsNullOrEmpty(appMod.Pay_AccountID))
                {
                    throw new Exception("未设置商户号");
                }
                if (string.IsNullOrEmpty(appMod.Pay_Key))
                {
                    throw new Exception("未设置支付Key");
                }

                //首次进入自动跳转获取支付code
                if (!State.Equals("redirect"))
                {
                    string siteurl = HttpUtility.UrlEncode(SiteConfig.SiteInfo.SiteUrl + "/PayOnline/wxpay_mp.aspx?payno=" + PayNo + "&appid=" + appMod.ID + "&SuccessUrl=" + SuccessUrl);
                    string url     = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appMod.APPID + "&redirect_uri=" + siteurl + "&response_type=code&scope=snsapi_userinfo&state=redirect#wechat_redirect";
                    Response.Redirect(url);
                }
                WeiXinPay();//统一下单,并填充预付单号
                timestr = WxAPI.HP_GetTimeStamp();
                string stringA        = "appId=" + appMod.APPID + "&nonceStr=" + WxAPI.nonce + "&package=prepay_id=" + prepay_id + "&signType=MD5&timeStamp=" + timestr;
                string stringSignTemp = stringA + "&key=" + appMod.Pay_Key;
                paySign = StringHelper.MD5(stringSignTemp).ToUpper();
            }
        }