public void ProcessRequest(HttpContext context) { string where = context.Request.QueryString["where"]; string openid = context.Request.QueryString["openid"]; string action = context.Request.QueryString["action"]; string order_id = context.Request.QueryString["order_dd"]; if (action == "order") { context.Response.ContentType = "text/json"; context.Response.Write(MyCommFun.GetJsonByDataset(order_new(openid, where))); } else if (action == "delete_order") { Dictionary <string, string> jsonDict = new Dictionary <string, string>(); jsonDict = new Dictionary <string, string>(); Update_delete("已删除", order_id); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", "更新成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else if (action == "list") { context.Response.ContentType = "text/json"; context.Response.Write(MyCommFun.GetJsonByDataset(list())); } }
public void ProcessRequest(HttpContext context) { int number = MyCommFun.RequestInt("number"); int page = MyCommFun.RequestInt("page"); string where = MyCommFun.RequestParam("where"); string open_id = MyCommFun.RequestParam("open_idss"); string action = MyCommFun.RequestParam("action"); string mmm = "Hg_number asc"; int recordCount = 0; int ord = MyCommFun.RequestInt("orderid"); string order_123 = MyCommFun.RequestParam("order_123"); string pic_name = MyCommFun.RequestParam("pickname"); if (action == "no_order") { context.Response.ContentType = "text/json"; context.Response.Write(MyCommFun.GetJsonByDataset(No_order(open_id, where))); } else if (action == "delete_order") { Dictionary <string, string> jsonDict = new Dictionary <string, string>(); jsonDict = new Dictionary <string, string>(); BLL.HG.Hg_list order = new BLL.HG.Hg_list(); order.DeleteList(ord); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", "删除成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else if (action == "pay_update") { Dictionary <string, string> jsonDict = new Dictionary <string, string>(); jsonDict = new Dictionary <string, string>(); BLL.HG.Hg_list order = new BLL.HG.Hg_list(); order.update("已支付", order_123); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", "更新成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else if (action == "File") { Dictionary <string, string> jsonDict = new Dictionary <string, string>(); jsonDict = new Dictionary <string, string>(); BLL.HG.Hg_list order = new BLL.HG.Hg_list(); WriteTextLog(DateTime.Now); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", "更新成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { context.Response.Write(MyCommFun.GetJsonByDataset(Hgdata(8, page))); } }
public void ProcessRequest(HttpContext context) { string channel_name = MyCommFun.RequestParam("channel_name"); int pagesize = MyCommFun.RequestInt("page"); string orderby1 = "id asc"; int pageindex = MyCommFun.RequestInt("index"); int recordCount = 0; context.Response.ContentType = "text/json"; context.Response.Write(MyCommFun.GetJsonByDataset(GetList(channel_name, category_id, pagesize, pageindex, "wid=" + wid, orderby1, out recordCount))); }
// string pass = MyCommFun.RequestParam("pass_1"); public void ProcessRequest(HttpContext context) { string action = MyCommFun.RequestParam("action"); int user = MyCommFun.RequestInt("Hg_number"); string order = MyCommFun.RequestParam("order_number"); string text = MyCommFun.RequestParam("text"); if (action == "Suc_pay") { context.Response.ContentType = "text/json"; context.Response.Write(MyCommFun.GetJsonByDataset(Get_pay(user))); } else if (action == "all_suc") { context.Response.ContentType = "text/json"; context.Response.Write(MyCommFun.GetJsonByDataset(Get_all(user))); } else if (action == "upload_start") { if (Update_start(text, order) == true) { context.Response.ContentType = "text/json"; Dictionary <string, string> jsonDict = new Dictionary <string, string>(); jsonDict = new Dictionary <string, string>(); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", "更新成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { context.Response.ContentType = "text/json"; Dictionary <string, string> jsonDict = new Dictionary <string, string>(); jsonDict = new Dictionary <string, string>(); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", "fail!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; BLL.wx_shop_cart cartBll = new BLL.wx_shop_cart(); string _action = MyCommFun.QueryString("myact"); string openid = MyCommFun.RequestOpenid(); //得到微信用户的openid Dictionary <string, string> jsonDict = new Dictionary <string, string>(); if (_action == "addCart") { #region 添加购物车 try { int wid = MyCommFun.RequestInt("wid"); int productId = MyCommFun.RequestInt("productid"); string skuId = MyCommFun.QueryString("mid"); string skuInfo = MyCommFun.QueryString("attr"); int productNum = MyCommFun.RequestInt("bc"); decimal totalPrice = (decimal)MyCommFun.RequestFloat("totprice", 0); Model.wx_shop_cart cart = new Model.wx_shop_cart(); IList <Model.wx_shop_cart> cartList = cartBll.GetModelList("productId=" + productId + " and openid='" + openid + "' and skuId='" + skuId + "'"); int getCartCount = cartBll.GetRecordCount("wid=" + wid + " and openid='" + openid + "'"); bool isAdd = true; if (cartList != null && cartList.Count > 0) { isAdd = false; cart = cartList[0]; } if (isAdd) { cart.createDate = DateTime.Now; cart.openid = openid; cart.productId = productId; cart.productNum = productNum; cart.skuId = skuId; cart.skuInfo = skuInfo; cart.totPrice = totalPrice * productNum; cart.wid = wid; int ret = cartBll.Add(cart); if (ret > 0) { jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", "添加购物车成功!"); jsonDict.Add("cartcount", (getCartCount + 1).ToString()); } else { jsonDict.Add("errCode", "true"); jsonDict.Add("recontent", "添加购物车失败!"); jsonDict.Add("cartcount", getCartCount.ToString()); } } else { cart.openid = openid; cart.productNum += productNum; cart.skuId = skuId; cart.skuInfo = skuInfo; cart.totPrice += totalPrice * productNum; cart.wid = wid; bool ret = cartBll.Update(cart); if (ret) { jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", "更新购物车成功!"); jsonDict.Add("cartcount", getCartCount.ToString()); } else { jsonDict.Add("errCode", "true"); jsonDict.Add("recontent", "更新购物车失败!"); jsonDict.Add("cartcount", getCartCount.ToString()); } } } catch (Exception ex) { jsonDict.Add("errCode", "true"); jsonDict.Add("recontent", "添加购物车失败!"); } finally { context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } #endregion } else if (_action == "pcount") { #region 购物车商品数量 jsonDict = new Dictionary <string, string>(); int wid = MyCommFun.RequestInt("wid"); int count = cartBll.GetRecordCount("wid=" + wid + " and openid='" + openid + "'"); jsonDict.Add("data", count.ToString()); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); #endregion } else if (_action == "remove") { #region 移除购物车商品 jsonDict = new Dictionary <string, string>(); int cartId = MyCommFun.RequestInt("id"); cartBll.Delete(cartId); jsonDict.Add("errCode", "false"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); #endregion } else if (_action == "modifyNum") { #region 修改购物车商品数量 jsonDict = new Dictionary <string, string>(); int cartId = MyCommFun.RequestInt("ic"); int newNum = MyCommFun.RequestInt("bc"); cartBll.UpdateNum(cartId, newNum); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", "更新成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); #endregion } else if (_action == "getCity") { #region 择省份,改变城市列表 int privice = MyCommFun.RequestInt("pvid"); BLL.pre_common_district areaBll = new BLL.pre_common_district(); IList <Model.pre_common_district> disList = areaBll.GetModelList("upid=" + privice + " and level=2"); Model.pre_common_district dis; StringBuilder jsonStr = new StringBuilder("{\"errCode\":0,\"retCode\":0,\"msgType\":0,\"errMsg\":\"\",\"data\":["); for (int i = 0; i < disList.Count; i++) { dis = new Model.pre_common_district(); if (i != disList.Count - 1) { jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"},"); } else { jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"}"); } } jsonStr.Append("]}"); context.Response.Write(jsonStr); #endregion } else if (_action == "getArea") { #region 择城市,改变区域列表 int ctid = MyCommFun.RequestInt("ctid"); BLL.pre_common_district areaBll = new BLL.pre_common_district(); IList <Model.pre_common_district> disList = areaBll.GetModelList("upid=" + ctid + " and level=3"); Model.pre_common_district dis; StringBuilder jsonStr = new StringBuilder("{\"errCode\":0,\"retCode\":0,\"msgType\":0,\"errMsg\":\"\",\"data\":["); for (int i = 0; i < disList.Count; i++) { dis = new Model.pre_common_district(); if (i != disList.Count - 1) { jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"},"); } else { jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"}"); } } jsonStr.Append("]}"); context.Response.Write(jsonStr); #endregion } else if (_action == "order_save") { #region 保存订单信息 //获得传参信息 int wid = MyCommFun.RequestInt("wid"); int payment_id = MyCommFun.RequestInt("pc"); //支付方式:1货到付款;3微支付 int express_id = MyCommFun.RequestInt("mtype"); //物流方式 // string orderStrList = MyCommFun.QueryString("orderStrList"); //检查物流方式 if (express_id == 0) { context.Response.Write("{\"errCode\":3, \"msg\":\"对不起,请选择配送方式!\"}"); return; } BLL.wx_shop_user_addr uAddrBll = new BLL.wx_shop_user_addr(); IList <Model.wx_shop_user_addr> uaddrList = uAddrBll.GetOpenidAddrName(openid, wid); if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0) { context.Response.Write("{\"errCode\":3, \"msg\":\"收货地址不存在,无法结算!\"}"); return; } //检查购物车商品 IList <Model.cartProduct> cartList = cartBll.GetCartList(openid, wid); if (cartList == null) { context.Response.Write("{\"errCode\":3, \"msg\":\"对不起,购物车为空,无法结算!\"}"); return; } //统计购物车 decimal payable_amount = cartList.Sum(c => c.totPrice); //物流费用 BLL.express expressBll = new BLL.express(); Model.express expModel = expressBll.GetModel(express_id); //支付方式 BLL.payment pbll = new BLL.payment(); Model.payment payModel = pbll.GetModelBypTypeId(payment_id); //保存订单======================================================================= Model.orders model = new Model.orders(); model.order_no = "b" + Utils.GetOrderNumber(); //订单号B开头为商品订单 model.wid = wid; model.openid = openid; model.modelName = "微商城"; model.modelCode = "shop"; model.modelActionName = ""; model.modelActionId = 0; model.user_id = 0; model.user_name = ""; model.payment_id = payment_id; model.express_id = express_id; model.accept_name = uaddrList[0].contractPerson; model.post_code = ""; model.telphone = uaddrList[0].tel; model.mobile = uaddrList[0].tel; model.area = uaddrList[0].province; model.city = uaddrList[0].city; model.district = uaddrList[0].area; model.address = uaddrList[0].province + " " + uaddrList[0].city + " " + uaddrList[0].area + " " + uaddrList[0].addrDetail; model.message = ""; model.payable_amount = payable_amount; //应付商品总金额 model.real_amount = payable_amount; //实际商品总金额, model.status = 1; model.express_status = 1; model.express_fee = expModel.express_fee; //物流费用 if (payment_id == 1) { //货到付款,需要确认订单 model.payment_status = 0; //标记未付款 } else { //先款后货 model.payment_status = 1; //标记未付款 } bool quicklyFH = false; //如果是先款后货的话 if (payment_id == 3) { if (payModel.poundage_type == 1) //百分比 { model.payment_fee = model.real_amount * payModel.poundage_amount / 100; } else //固定金额 { model.payment_fee = payModel.poundage_amount; } BLL.wx_payment_wxpay wxBll = new BLL.wx_payment_wxpay(); Model.wx_payment_wxpay wxpay = wxBll.GetModelByWid(wid); quicklyFH = wxpay.quicklyFH; } if (quicklyFH) { model.express_status = 0; } //订单总金额=实付商品金额+运费+支付手续费 model.order_amount = model.real_amount + model.express_fee + model.payment_fee; //购物积分,可为负数 model.point = 0; model.add_time = DateTime.Now; //商品详细列表 List <Model.order_goods> gls = new List <Model.order_goods>(); foreach (Model.cartProduct item in cartList) { gls.Add(new Model.order_goods { goods_id = item.productId, goods_title = item.productName, goods_price = item.totPrice, real_price = item.totPrice, quantity = item.productNum, point = 0 }); } model.order_goods = gls; int result = new BLL.orders().Add(model); if (result < 1) { context.Response.Write("{\"errCode\":3, \"msg\":\"订单保存过程中发生错误,请重新提交!\"}"); return; } //清空购物车 cartBll.RemoveCartInfo(wid, openid); //提交成功,返回URL order_no context.Response.Write("{\"errCode\":true, \"payType\":\"" + payment_id + "\", \"order_no\":\"" + model.order_no + "\",\"orderid\":\"" + result + "\",\"wid\":\"" + wid + "\",\"openid\":\"" + openid + "\",\"payable_amount\":\"" + payable_amount + "\", \"msg\":\"恭喜您,订单已成功提交!\"}"); return; #endregion } else if (_action == "order_canel") { #region //取消订单 int orderid = MyCommFun.RequestInt("order_id"); BLL.orders oBll = new BLL.orders(); oBll.UpdateField(orderid, "status=4"); context.Response.Write("{\"errCode\":true, \"msg\":\"订单已取消!\"}"); #endregion } else if (_action == "fukuan") { #region //在线支付 int orderid = MyCommFun.RequestInt("order_id"); BLL.orders oBll = new BLL.orders(); Model.orders order = oBll.GetModel(orderid); oBll.UpdateField(orderid, "express_status=1,payment_status=2 , status=2"); context.Response.Write("{\"errCode\":true, \"msg\":\"付款成功!\"}"); #endregion } else if (_action == "shouhuo") { #region //确认收货 int orderid = MyCommFun.RequestInt("order_id"); BLL.orders oBll = new BLL.orders(); Model.orders order = oBll.GetModel(orderid); //if (order.payment_id == 1) //{ //货到付款 // oBll.UpdateField(orderid, "express_status=2,payment_status=2 , status=3"); // } // else //{ //在线支付 oBll.UpdateField(orderid, "express_status=2,payment_status=2 , status=6"); // } context.Response.Write("{\"errCode\":true, \"msg\":\"交易完成!\"}"); #endregion } else if (_action == "so") { #region //产品搜索,主要字段名称,分类,简介 int wid = MyCommFun.RequestInt("wid"); string pagesizeStr = MyCommFun.RequestParam("pagesize"); string orderby = " id desc"; int currPage = MyCommFun.RequestInt("currPage");; //当前页面 int recordCount = 0; //总记录数 int totPage = 1; //总页数 int pageSize = MyCommFun.Str2Int(pagesizeStr); //每页的记录数 if (pageSize <= 0) { pageSize = 10; } if (MyCommFun.RequestInt("page") > 0) { currPage = 1; } string key = MyCommFun.RequestParam("key"); DataSet productlist = new DataSet(); DAL.wx_shop_product artDal = new DAL.wx_shop_product(); productlist = artDal.SoGetList(wid, key, pageSize, currPage, "upselling=1", orderby, out recordCount); if (productlist != null && productlist.Tables.Count > 0 && productlist.Tables[0].Rows.Count > 0) { DataRow dr; for (int i = 0; i < productlist.Tables[0].Rows.Count; i++) { dr = productlist.Tables[0].Rows[i]; dr["p_count"] = recordCount; if (dr["link_url"] != null && dr["link_url"].ToString().Trim().Length > 0) { dr["link_url"] = MyCommFun.urlAddOpenid(dr["link_url"].ToString().Trim(), openid); } else { dr["link_url"] = MyCommFun.urlAddOpenid("detail.aspx?wid=" + wid + "&pid=" + dr["id"].ToString(), openid); } productlist.AcceptChanges(); } context.Response.Write(MyCommFun.GetJsonByDataset(productlist)); } #endregion } }
public void ProcessRequest(HttpContext context) { Model.HG.A_HG_new_order Str = new Model.HG.A_HG_new_order(); BLL.HG.Hg_list add = new BLL.HG.Hg_list(); Dictionary <string, string> jsonDict = new Dictionary <string, string>(); jsonDict = new Dictionary <string, string>(); string case_ = context.Request.QueryString["case_"]; if (case_ == "save") { // string openid=context.Request.QueryString["openid"]; string name = context.Request.QueryString["name"]; string phone = context.Request.QueryString["phone"]; string sex = context.Request.QueryString["sex"]; string money = context.Request.QueryString["money"]; string type_ = context.Request.QueryString["type_"]; string time = context.Request.QueryString["time"]; string day = context.Request.QueryString["day"]; string adress = context.Request.QueryString["adress"]; string weixiname = context.Request.QueryString["weixinname"]; string openid = context.Request.QueryString["openid"]; // string total=context.Request.QueryString["total"]; // Str.Openid_ = openid; Str.Name_ = name; Str.Tel_ = phone; Str.Sex_ = sex; Str.Pick_many = money; Str.Type_ = type_; Str.Time_ = time; Str.start_time = DateTime.Now.ToString();//开始时间 Str.Pick_day = day; Str.Weixin_name = weixiname; Str.Openid_ = openid; int day_ = int.Parse(day); int money_ = int.Parse(money); int total_ = day_ * money_; Str.total = total_.ToString(); string bb = DateTime.Now.Day.ToString() + GuidTo16String();//生成的订单号 Str.Order_dd = bb; Str.Order_from = "小程序"; Str.Fw_zt = "未支付"; Str.Delet_ = "未删除"; Str.Adress = adress; int fal = add.Add_order_new(Str); // Str.total = total; if (fal == 0) { jsonDict.Add("order_dd", bb); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", fal.ToString()); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { jsonDict.Add("order_dd", bb); jsonDict.Add("errCode", "true"); jsonDict.Add("recontent", fal.ToString()); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } else if (case_ == "jujia") { { // string openid=context.Request.QueryString["openid"]; string name = context.Request.QueryString["name"]; string phone = context.Request.QueryString["phone"]; string sex = context.Request.QueryString["sex"]; string money = context.Request.QueryString["money"]; string type_ = context.Request.QueryString["type_"]; string time = context.Request.QueryString["time"]; string day = context.Request.QueryString["day"]; string adress = context.Request.QueryString["adress"]; string weixiname = context.Request.QueryString["weixinname"]; string openid = context.Request.QueryString["openid"]; // string total=context.Request.QueryString["total"]; // Str.Openid_ = openid; Str.Name_ = name; Str.Tel_ = phone; Str.Sex_ = sex; Str.Pick_many = money; Str.Type_ = type_; Str.Time_ = time; Str.start_time = DateTime.Now.ToString();//开始时间 Str.Pick_day = day; Str.Weixin_name = weixiname; Str.Openid_ = openid; Str.total = money; string bb = DateTime.Now.Day.ToString() + GuidTo16String();//生成的订单号 Str.Order_dd = bb; Str.Order_from = "小程序"; Str.Fw_zt = "未支付"; Str.Delet_ = "未删除"; Str.Adress = adress; int fal = add.Add_order_new(Str); // Str.total = total; if (fal == 0) { jsonDict.Add("order_dd", bb); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", fal.ToString()); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { jsonDict.Add("order_dd", bb); jsonDict.Add("errCode", "true"); jsonDict.Add("recontent", fal.ToString()); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } } else if (case_ == "order") { string openid = context.Request.QueryString["openid"]; context.Response.ContentType = "text/json"; context.Response.Write(MyCommFun.GetJsonByDataset(order_new(openid))); } else { order_dd = MyCommFun.QueryString("order"); BLL.HG.Hg_list order_T = new BLL.HG.Hg_list(); Model.HG.A_HG_new_order model = order_T.getorder(order_dd); string timeStamp = ""; string nonceStr = ""; string paySign = ""; //创建支付应答对象 Senparc.Weixin.MP.TenPayLibV3.RequestHandler packageReqHandler = new Senparc.Weixin.MP.TenPayLibV3.RequestHandler(null); //初始化 packageReqHandler.Init(); timeStamp = TenPayV3Util.GetTimestamp(); nonceStr = TenPayV3Util.GetNoncestr(); //设置package订单参数 packageReqHandler.SetParameter("appid", "wx16650bedd9b0916a"); //公众账号ID packageReqHandler.SetParameter("mch_id", "1403543902"); //商户号 packageReqHandler.SetParameter("nonce_str", nonceStr); //随机字符串 packageReqHandler.SetParameter("body", model.Name_ + "服务"); //商品信息 packageReqHandler.SetParameter("out_trade_no", order_dd); //商家订单号 packageReqHandler.SetParameter("total_fee", ((double.Parse(model.total)) * 100).ToString()); //商品金额,以分为单位(money * 100).ToString() packageReqHandler.SetParameter("spbill_create_ip", context.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP packageReqHandler.SetParameter("notify_url", MyCommFun.getWebSite() + "/api/wxpay/notify_url.aspx?wid=" + 44 + "|" + order_dd); //接收财付通通知的URL packageReqHandler.SetParameter("trade_type", TenPayV3Type.JSAPI.ToString()); //交易类型 packageReqHandler.SetParameter("openid", model.Openid_); //用户的openId string sign = packageReqHandler.CreateMd5Sign("key", "70OvzuXGLFP7539B9zbvEMUBd1H1Tv8Q"); packageReqHandler.SetParameter("sign", sign); //签名 string data = packageReqHandler.ParseXML(); var result = TenPayV3.Unifiedorder(data); DateTime bb111 = new DateTime(); WriteTextLog(bb111, result); var res = XDocument.Parse(result); string prepayId = res.Element("xml").Element("prepay_id").Value; //设置支付参数 RequestHandler paySignReqHandler = new RequestHandler(null); paySignReqHandler.SetParameter("appId", "wx16650bedd9b0916a"); paySignReqHandler.SetParameter("timeStamp", timeStamp); paySignReqHandler.SetParameter("nonceStr", nonceStr); paySignReqHandler.SetParameter("package", string.Format("prepay_id={0}", prepayId)); paySignReqHandler.SetParameter("signType", "MD5"); paySign = paySignReqHandler.CreateMd5Sign("key", "70OvzuXGLFP7539B9zbvEMUBd1H1Tv8Q"); payaddid = ""; paytimeStamp = timeStamp; paynonceStr = nonceStr; paypackageValue = string.Format("prepay_id={0}", prepayId); paypaySign = paySign; litDate = DateTime.Now.ToString(); oreder_name = model.Name_ + "服务预约"; context.Response.ContentType = "text/json"; pay_ bb = new pay_ { timeStamp = timeStamp, nonceStr = nonceStr, paySign = paySign, signType = "MD5", package = prepayId }; string json_bill = JsonMapper.ToJson(bb); context.Response.Write(json_bill); } }