Пример #1
0
 /// <summary>
 /// 微信公众号第一次跳转
 /// </summary>
 /// <param name="Oid">订单id</param>
 private void OnJump(int Oid)
 {
     try
     {
         string          str  = "";
         JMP.MDL.jmp_app mo   = new JMP.MDL.jmp_app();
         JMP.BLL.jmp_app blls = new JMP.BLL.jmp_app();
         mo = JMP.TOOL.MdlList.ToModel <JMP.MDL.jmp_app>(blls.GetList(" a_id=(SELECT o_app_id FROM jmp_order WHERE o_id=" + Oid + ")  ").Tables[0]);
         if (mo != null)
         {
             SelectInterface SeIn  = new SelectInterface();
             string          cache = "wxgfgzh" + Oid;
             SeIn = SelectInfo(cache, mo.a_rid, mo.a_id, int.Parse(ConfigurationManager.AppSettings["CacheTime"].ToString()));
             if (SeIn == null || SeIn.PayId <= 0 || string.IsNullOrEmpty(SeIn.UserId) || string.IsNullOrEmpty(SeIn.UserKey))
             {
                 str = "{\"Message\":\"支付通道未配置\",\"ErrorCode\":106}";
                 Response.Write(str);
             }
             JMP.BLL.jmp_order bll    = new JMP.BLL.jmp_order();
             JMP.MDL.jmp_order morder = bll.SelectOrderGoodsName(Oid, "jmp_order");
             if (morder.o_price < SeIn.minmun)
             {
                 str = "{\"Message\":\"订单金额不能小于单笔最小支付金额\",\"ErrorCode\":8990}";
                 Response.Write(str);
             }
             if (morder.o_price > SeIn.maximum)
             {
                 str = "{\"Message\":\"订单金额不能大于单笔最大支付金额\",\"ErrorCode\":8989}";
                 Response.Write(str);
             }
             if (bll.UpdatePay(Oid, SeIn.PayId))
             {
                 string redirect_uri = ConfigurationManager.AppSettings["WxGzhRturnUrl"].ToString() + Oid + ".html";
                 PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + "回调地址:" + redirect_uri, summary: "微信官方公众号第一次跳转支付接口错误信息", channelId: Oid);
                 string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + SeIn.wxappid + "&redirect_uri=" + redirect_uri + "&response_type=code&scope=snsapi_base#wechat_redirect";
                 Response.Redirect(url, false);
             }
         }
         else
         {
             str = "{\"Message\":\"支付接口异常\",\"ErrorCode\":102}";
             Response.Write(str);
         }
     }
     catch (Exception ex)
     {
         PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + ex.Message, summary: "微信官方公众号第一次跳转支付接口错误信息", channelId: Oid);
         Response.Write("非法访问!");
     }
 }