protected void btnCharge_Click(object sender, EventArgs e) { //var recharData = { "action": "IDIP_DO_PAY_CASH_REQ", "remark": "2017100402", "dis_uin": 10372, "src_uin": 10372, "role_name": "niuniu", "us_source": "2", "amount": "20", "ui_ip": "127.1.1.1", "gameId": "hlynzy", "sz_desc": "充值" }; //var strData = JSON.stringify(recharData); string payMoney = ""; string payWapType = "4"; string payOutTradeNo = DateTime.Now.ToString("yyyyMMddhhmmss"); string paySubject = ""; if (this.SelectCount() == 1) { string strId = string.Empty; foreach (GridViewRow gvrow in gvUsers.Rows) { CheckBox CheckBox = gvrow.FindControl("chbSelect") as CheckBox; if (CheckBox.Checked) { payMoney = this.gvUsers.DataKeys[gvrow.RowIndex]["Mg_price"].ToString(); paySubject = this.gvUsers.DataKeys[gvrow.RowIndex]["Mg_Name"].ToString(); } } } else if (this.SelectCount() == 0) { //Jswork.Alert("请选择一条记录进行修改", this.Page); this.divAlert.Visible = true; //this.lblAlert.Text = "请选择一条要购买的商品"; //""; Jswork.Alert("请选择一条要购买的商品", this.Page); return; } else { //Jswork.Alert("一次只能修改一条记录", this.Page); this.divAlert.Visible = true; //this.lblAlert.Text = "一次只能购买一个商品"; //"一次只能修改一条记录"; Jswork.Alert("一次只能购买一个商品", this.Page); return; } //int payMoneyNum = Convert.ToInt32(payMoney) * 100; string curuserId = Session["currentgameid"].ToString(); string trandeNo = PubFuncs.GenerateOrderNumber(); string payUrl = PayUlity.ZYFPay("9", payWapType, trandeNo, paySubject, curuserId); //this.divAlert.Visible = true; //this.lblAlert.Text = payOutTradeNo; //"一次只能修改一条记录"; if (!string.IsNullOrEmpty(payUrl)) { Response.Redirect(payUrl); } /* * var iUrl = "http://192.168.1.101:8888"; * * using (var client = new WebClient()) * { * * Dictionary<string, string> dic = new Dictionary<string, string>(); * dic["action"] = "IDIP_DO_PAY_CASH_REQ"; * dic["remark"] = "2017100402"; * dic["dis_uin"] = "10372"; * dic["src_uin"] = "10372"; * dic["role_name"] = "niuniu"; * dic["us_source"] = "2"; * dic["amount"] = "20"; * dic["ui_ip"] = "127.1.1.1"; * dic["gameId"] = "hlynzy"; * dic["sz_desc"] = "充值"; * string json = new JavaScriptSerializer().Serialize(dic); * * string responseStr = HttpClientUlity.PostJsonData(iUrl, json); * * this.divAlert.Visible = true; * this.lblAlert.Text = Resources.Resource.diamond_charge_suc; //"钻石充值成功"; * } */ }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //context.Request.ContentEncoding = Encoding.GetEncoding("gb2312"); #region 牛状元 /* * appId = 148999970238152 * appkey = ey12lW6mWurQAL73JMiSjZWj3T8p6rxK * * * 应用ID: * appId=147245449905115 * 应用密钥: * appKey=nxY3Gysbt3cCo9k6xdLSpch4MFg3S2bI * */ /* * Dictionary<string, string> paratStr = new Dictionary<string, string>(); * StringBuilder sb = new StringBuilder(); * paratStr.Add("funcode", "funcode=WP001"); * paratStr.Add("version", "version=1.0.0"); * paratStr.Add("appId", "appId=147245449905115"); * paratStr.Add("mhtOrderNo", "mhtOrderNo=1506827619125"); * paratStr.Add("mhtOrderName", "mhtOrderName=merchantTest"); * paratStr.Add("mhtCurrencyType", "mhtCurrencyType=156"); * paratStr.Add("mhtOrderAmt", "mhtOrderAmt=10"); * paratStr.Add("mhtOrderDetail", "mhtOrderDetail=mhtOrderDetail"); * paratStr.Add("mhtOrderType", "mhtOrderType=01"); * paratStr.Add("mhtOrderStartTime", "mhtOrderStartTime=" + DateTime.Now.ToString("yyyyMMddHHmmss")); * paratStr.Add("notifyUrl", "notifyUrl=http://posp.ipaynow.cn:10808/mobilewaptest/notify"); * paratStr.Add("frontNotifyUrl", "frontNotifyUrl=http://posp.ipaynow.cn:10808/mobilewaptest/frontnotify"); * paratStr.Add("mhtCharset", "mhtCharset=UTF-8"); * paratStr.Add("deviceType", "deviceType=08"); * paratStr.Add("payChannelType", "payChannelType=13"); * paratStr.Add("outputType", "outputType=1"); * paratStr.Add("mhtSignType", "mhtSignType=MD5"); * * paratStr = (from entry in paratStr * orderby entry.Key ascending * select entry).ToDictionary(pair => pair.Key, pair => pair.Value); * * List<string> optList = new List<string>(); * foreach (var key2 in paratStr) * { * optList.Add(key2.Value); * } * * for (var i = 0; i < optList.Count; i++) * { * if (i == optList.Count - 1) * { * sb.Append(optList[i]); * } * else * { * sb.Append(optList[i] + "&"); * } * } * * string queryUrl = "https://pay.ipaynow.cn?"; * string MD5Key = "nxY3Gysbt3cCo9k6xdLSpch4MFg3S2bI"; //ey12lW6mWurQAL73JMiSjZWj3T8p6rxK * * //string mhtSignatureStr = "appId=148999970238152&frontNotifyUrl=http://posp.ipaynow.cn:10808/mobilewaptest/frontnotify" + * // "&mhtCharset=UTF-8&mhtCurrencyType=156&mhtOrderAmt=10&mhtOrderDetail=mhtOrderDetail&mhtOrderName=merchantTest&mhtOrderNo=1506827619120" + * // "&mhtOrderStartTime=" + DateTime.Now.ToString("yyyyMMddHHmmss") + "&mhtOrderType=01¬ifyUrl=http://posp.ipaynow.cn:10808/mobilewaptest/notify&payChannelType=13&5770c97131bd3aa136fdd46afdeec9f4"; * * * string mhtSignatureStrResullt = Security.MD5(MD5Key); * string MD5Result1 = Security.MD5(sb.ToString() + "&" + mhtSignatureStrResullt); * * string outUrl = queryUrl + sb.ToString() + "&mhtSignature=" + MD5Result1; * context.Response.Write(outUrl); */ #endregion #region 掌宜付 //APP_ID = 3947(应用ID) //PARTNER_ID = 1000100020001688(商户ID) //KEY = 86FE35EFBDD846A0868A43CD13BFD4AE(秘钥) //QN = //请在子渠道管理模块下选择该应用的一个渠道代码(qn) //string basePath = "http://pay.csl2016.cn:8000/"; /** * 商户ID **/ //string partnerId = "1000100020001688";//request.getParameter("partnerId"); /** * 应用ID **/ //string appId = "3947";//request.getParameter("appId"); /** * 支付金额(正整数,以分为单位) * **/ //string money = "10";//request.getParameter("money"); /** * 支付方式(1 微信H5,2 支付宝H5,3 银联H5,4 微信扫码,5 微信公众号,6 QQ钱包) **/ //string wapType = "4";//request.getParameter("wapType"); /** * 商户订单号(需保证同⼀app_id下唯一,交易结果回 * 调通知将传递此参数,支付结果查询也 * 使用此参数。) **/ //string outTradeNo = "261215095524963127";//request.getParameter("outTradeNo"); /*** * * **/ /*** * 设备识别码 * **/ //string imei = "imei";//request.getParameter("imei"); /** * 商户渠道代码 **/ //string qn = "q156";//request.getParameter("qn"); /** * 商户密钥 **/ //string key = "86FE35EFBDD846A0868A43CD13BFD4AE";//request.getParameter("key"); /*** * 支付后返回地址(需进行URL encode) * **/ //string returnUrl = "http://wyx.aizhidiaosu.com/WptMall/payResponse.ashx";//request.getParameter("returnUrl"); /** * 商品名称 **/ //string subject = "good01";//request.getParameter("subject"); //string action = "create";//request.getParameter("action"); //string reqParams = "partner_id=" + partnerId + "&app_id=" + appId + "&out_trade_no=" + outTradeNo; //string reqAction = "/queryOrder.e"; //if ("create".Equals(action)) //{ // reqAction = "/createOrder.e"; // reqParams += // "&money=" + money + // "&wap_type=" + wapType + // "&qn=" + qn + // "&imei=" + imei + // "&return_url=" + HttpUtility.UrlEncode(returnUrl, System.Text.Encoding.UTF8) + // "&subject=" + HttpUtility.UrlEncode(subject, System.Text.Encoding.UTF8); // if ("3".Equals(wapType)) // { // reqParams += "&bank_code=" + "";//request.getParameter("bankCode"); // } //} //Dictionary<string, string> zyfparatStr = new Dictionary<string, string>(); //StringBuilder zyfsb = new StringBuilder(); //zyfparatStr.Add("partner_id", "partner_id=1000100020001688"); //zyfparatStr.Add("app_id", "app_id=3947"); //zyfparatStr.Add("out_trade_no", "out_trade_no=" + outTradeNo); //zyfparatStr.Add("money", "money=10"); //zyfparatStr.Add("wap_type", "wap_type=4"); //zyfparatStr.Add("qn", "qn=q156"); ////zyfparatStr.Add("imei", "imei=imeiqqq"); //zyfparatStr.Add("return_url", "return_url=" + HttpUtility.UrlEncode("http://wyx.aizhidiaosu.com/WptMall/payResponse.ashx")); //zyfparatStr.Add("subject", "subject=good01"); //zyfparatStr = (from entry in zyfparatStr // orderby entry.Key ascending // select entry).ToDictionary(pair => pair.Key, pair => pair.Value); //List<string> zyfList = new List<string>(); //foreach (var key1 in zyfparatStr) //{ // zyfList.Add(key1.Value); //} //for (var i = 0; i < zyfList.Count; i++) //{ // if (i == zyfList.Count - 1) // { // zyfsb.Append(zyfList[i]); // } // else // { // zyfsb.Append(zyfList[i] + "&"); // } //} //zyfsb.Append("&key=86FE35EFBDD846A0868A43CD13BFD4AE"); //string sign = Security.MD5(zyfsb.ToString()); //string visitUrl = basePath + reqAction + "?" + reqParams + "&sign=" + HttpUtility.UrlEncode(sign, System.Text.Encoding.UTF8).ToUpper(); #endregion //context.Response.Write(outUrl); //http://wyx.aizhidiaosu.com/WptMall/getGoodsList.ashx?goodId=1006&goodName=good6&goodMoney=500&userDetail={"userUid":10260,"unionid":"o4_X2vk3c1ZbJdqrleN8ul0OF3ks"} //"userUid":10260,"unionid":"o4_X2vk3c1ZbJdqrleN8ul0OF3ks","duid":10012 if (string.IsNullOrEmpty(context.Request["goodId"]) || string.IsNullOrEmpty(context.Request["goodName"]) || string.IsNullOrEmpty(context.Request["goodMoney"]) || string.IsNullOrEmpty(context.Request["goodDetail"]) || string.IsNullOrEmpty(context.Request["userDetail"])) { context.Response.Write("param error"); } else { string goodNo = context.Request["goodId"].ToString(); string goodName = context.Request["goodName"].ToString(); string goodMoney = (Convert.ToInt32(context.Request["goodMoney"].ToString()) * 100).ToString(); string goodDetail = HttpUtility.UrlDecode(context.Request["goodDetail"].ToString(), Encoding.GetEncoding("utf-8"));; string useDetails = context.Request["userDetail"].ToString(); string uid = ""; int addNum = 0; MalltgoodsEO eo = mgMange.GetGoodsByPK(goodNo); if (eo != null) { addNum = Convert.ToInt32(eo.MgDiamondsnum) + Convert.ToInt32(eo.MgPresentnum); } if (!string.IsNullOrEmpty(useDetails)) { JObject jo = (JObject)JsonConvert.DeserializeObject(useDetails); uid = jo["userUid"].ToString(); } string trandeNo = DateTime.Now.ToString("yyyyMMddHHmmss"); string qnStr = string.Format("{0}_{1}", uid, addNum.ToString()); string payUrl = PayUlity.ZYFPay(goodMoney, "1", trandeNo, goodName, qnStr); context.Response.Write(payUrl); } //this.lblTotal.Text = jo["amount"].ToString(); }