protected void Page_Load(object sender, EventArgs e) { string strOpenID = string.Empty; string strIP = string.Empty; string strChargeType = string.Empty; string strCustNo = string.Empty; string strChargeAmount = string.Empty; string strCelWhere = string.Empty; string strDiscount = string.Empty; //ChargeFeeOK.aspx?type=$chargetype&openid=$OpenID&chargeno=$ChargeNo&chargeamount=$ChargeAmount if (null == Request.QueryString["type"]) { return; } if (null == Request.QueryString["openid"]) { return; } if (null == Request.QueryString["chargeno"]) { return; } if (null == Request.QueryString["chargeamount"]) { return; } if (null == Request.QueryString["celWhere"]) { return; } if (Request.QueryString["openid"].ToString().Length > 29 || Request.QueryString["openid"].ToString().Length < 25) { strOpenID = Common.Common.NoHtml(Request.QueryString["openid"].ToString()); } else { strOpenID = Request.QueryString["openid"].ToString(); } strIP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; strChargeType = Common.Common.NoHtml(Request.QueryString["type"].ToString()); strCustNo = Common.Common.NoHtml(Request.QueryString["chargeno"].ToString()); strChargeAmount = Common.Common.NoHtml(Request.QueryString["chargeamount"].ToString()); strCelWhere = Common.Common.NoHtml(Request.QueryString["celWhere"].ToString()); //插入订单数据 //调用支付接口返回成功写数据到缴费平台 //DAL.MiniShop.MSChargeFeeOrder dal = new DAL.MiniShop.MSChargeFeeOrder(); //Model.MiniShop.MSChargeFeeOrder model = new Model.MiniShop.MSChargeFeeOrder(); //model.ID = Guid.NewGuid().ToString("N").ToUpper(); //model.OpenID = strOpenID; //model.CustNo = strCustNo; //model.ChargeAmount = int.Parse(strChargeAmount + "000"); //model.ChargeIP = strIP; //model.State = 0; DAL.SYS.SYSDictionaryDAL dicDal = new DAL.SYS.SYSDictionaryDAL(); DAL.MiniShop.MSShoppingCartDAL dal = new MSShoppingCartDAL(); string strPID = "VH20141104210211"; string strCType = "话费充值"; if (strChargeType == "Q币充值") { strCType = "qbcz"; strPID = "VQ20141104210212"; strDiscount = dicDal.GetDictionaryValues("WXCZ_QB"); } else { strCType = "hfcz"; strPID = "VH20141104210211"; switch (strCelWhere) { case "CMCC": strDiscount = dicDal.GetDictionaryValues("WXCZ_YD"); break; case "CT": strDiscount = dicDal.GetDictionaryValues("WXCZ_DX"); break; case "CU": strDiscount = dicDal.GetDictionaryValues("WXCZ_LT"); break; default: strDiscount = "100"; break; } } string strOrderID = dal.SubVirtualProductOrder(strOpenID, strCustNo, strPID, strChargeAmount); if (!string.IsNullOrEmpty(strOrderID)) { WXJSAPIPay wxpay = new WXJSAPIPay("VYIGO"); wxpay.DirectWXJSAPIPay(this.Response, strCType, strOrderID, int.Parse(strChargeAmount + "00") * int.Parse(strDiscount) / 100, strIP, strOpenID, "http://www.vgo2013.com/PalmShop/ShopCode/ChargeFeeOver.aspx", null, strCType + "|" + strCustNo + "|" + strChargeAmount); } else { } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { errormsg = ""; #region ------------获取请求信息---------------- if (Request["pname"] != null && Request["pname"] != "") { pname = Request["pname"]; } if (Request["ordernum"] != null && Request["ordernum"] != "") { ordernum = Request["ordernum"]; } if (Request["countcost"] != null && Request["countcost"] != "") { countcost = Request["countcost"]; } if (Request["customid"] != null && Request["customid"] != "") { customid = Request["customid"]; } #endregion #region -获取用户openid if (Session["OpenID"] == null || Session["OpenID"].ToString() == "") { if (customid != null && customid != "") { MSCustomersDAL customerDal = new MSCustomersDAL(); try { strOpenID = customerDal.GetCustomerValueByID("OpenID", customid).ToString(); } catch (Exception) { } } } else { strOpenID = Session["OpenID"].ToString(); } #endregion if (Request["action"] != null && Request["action"] != "") { action = Request["action"]; string strSiteCode = "VYIGO"; WXJSAPIPay wxpay = new WXJSAPIPay(strSiteCode); MSProductOrderDAL ptitleDal = new MSProductOrderDAL(); switch (action.Trim().ToLower()) { case "alipay": //ptitleDal.UpdateOrderPayWay(ordernum, "alipay"); //payway= WapPayHelper.BuildRequest(pname, ordernum, countcost, customid); AliWapPay pay = new AliWapPay("VYIGO"); string notify_url = "http://www.vgo2013.com/PalmShop/ShopCode/NotifyUrl.aspx"; string call_back_url = "http://www.vgo2013.com/PalmShop/ShopCode/Alipayreturn.aspx"; pay.DirectAliWayPay(this.Response, pname, ordernum, countcost, customid, call_back_url, notify_url); break; case "wxpay": ptitle = ptitleDal.GetOrderTitleByOID(ordernum); strIP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; decimal countcostx = decimal.Parse(countcost); int v = (Int32)Math.Round(countcostx * 100, 0); try { wxpay.DirectWXJSAPIPay(this.Response, ptitle, ordernum, v, strIP, strOpenID, "http://www.vgo2013.com/PalmShop/ShopCode/PayState.aspx", null, ""); } catch (Exception emsg) { errormsg = JQDialog.alertOKMsgBox(5, emsg.Message, "", "error"); } break; } } GetHtmlPage(); } }