/// <summary> /// 店铺订单 确认收货 /// </summary> /// <param name="jsonArray"></param> /// <returns></returns> public string setUserOrderReceive(string jsonArray) { JavaScriptSerializer ser = new JavaScriptSerializer(); setUserOrderReceiveModel _model = ser.Deserialize<setUserOrderReceiveModel>(jsonArray); string username = _model.userId; long orderid = long.Parse(_model.orderId); string payPwd = _model.pwdPay; // 验证支付密码 PayService.PayService bll = new PayService.PayService(); bll.Url = System.Configuration.ConfigurationSettings.AppSettings["PayService"].ToString(); bool validPwd = bll.validPayPassword(username, payPwd); if (validPwd == false) return "{ \"status\": \"0\", \"statusMsg\": \"支付密码错误!\", \"returnData\": \"\"}"; StreetOrderService.GoodsOrderService _orderService = new StreetOrderService.GoodsOrderService(); _orderService.Url = System.Configuration.ConfigurationSettings.AppSettings["StreetOrderService"].ToString(); bool res = _orderService.GoodsOrderReceived(orderid); if (res) return "{ \"status\": \"1\", \"statusMsg\": \"\", \"returnData\": \"\"}"; else return "{ \"status\": \"0\", \"statusMsg\": \"\", \"returnData\": \"\"}"; }
/// <summary> /// 去火拼下单 /// </summary> /// <param name="jsonArray"></param> /// <returns></returns> public string setUserBuyCloud(string jsonArray) { try { JavaScriptSerializer ser = new JavaScriptSerializer(); setUserBuyCloudModel _model = ser.Deserialize<setUserBuyCloudModel>(jsonArray); StreetOrderService.GoodsOrderService _orderService = new StreetOrderService.GoodsOrderService(); _orderService.Url = System.Configuration.ConfigurationSettings.AppSettings["StreetOrderService"].ToString(); long productid = long.Parse(_model.cloudId); string username = _model.userId; int nums = int.Parse(_model.numsBuy); string regionname = _model.localIp; string ip = ZY.Framework.Common.IpHelper.GetHostIP(); string res = _orderService.CreateCloudOrder(productid, username, nums, regionname, ip); return res; } catch (Exception ex) { QH.ZY.Common.Log.SaveException(ex); return "{ \"status\": \"0\", \"statusMsg\": \"下单异常!!\", \"returnData\": \"\"}"; } }
/// <summary> /// 添加充值记录 /// </summary> /// <param name="jsonArray"></param> /// <returns></returns> public string addPayRecharge(string jsonArray) { JavaScriptSerializer ser = new JavaScriptSerializer(); addPayRechargeModel _modeljson = ser.Deserialize<addPayRechargeModel>(jsonArray); string username = _modeljson.userId; string paypwd = _modeljson.payPwd; // 部分在线支付的话,需要验证支付密码 if (_modeljson.mnyType == "0") { // 验证支付密码 PayService.PayService bll = new PayService.PayService(); bll.Url = System.Configuration.ConfigurationSettings.AppSettings["PayService"].ToString(); bool validPwd = bll.validPayPassword(username, paypwd); if (validPwd == false) return "{ \"status\": \"0\", \"statusMsg\": \"支付密码错误!\", \"returnData\": \"\"}"; } string bankName = ""; string returnUrl = ""; if (_modeljson.payType == "1") { bankName = "支付宝"; returnUrl = System.Configuration.ConfigurationSettings.AppSettings["StreetDomain"].ToString() + "/Pays/ReturnPage/Alipay/Phone/notify_url.aspx"; } if (_modeljson.payType == "2") { bankName = "微信"; returnUrl = System.Configuration.ConfigurationSettings.AppSettings["StreetDomain"].ToString() + "/Pays/ReturnPage/Weixin/notify_url.aspx"; } decimal amounts = decimal.Parse(_modeljson.payMoney); long orderid = long.Parse(_modeljson.orderList[0].id); int orderType = int.Parse(_modeljson.orderType); StreetOrderService.GoodsOrderService _orderService = new StreetOrderService.GoodsOrderService(); _orderService.Url = System.Configuration.ConfigurationSettings.AppSettings["StreetOrderService"].ToString(); string[] res = _orderService.AddPayRecharge(username, bankName, amounts, orderid, orderType); int newRechargeId = int.Parse(res[0]); string title = System.Web.HttpUtility.UrlEncode(res[1]); return "{ \"status\": \"1\", \"statusMsg\": \"\", \"returnData\": {\"id\": \"" + newRechargeId + "\",\"title\":\"" + title + "\",\"type\": \"" + _modeljson.payType + "\",\"url\": \"" + returnUrl + "\"}}"; }
/// <summary> /// 用户订单余额支付 /// </summary> /// <param name="jsonArray"></param> /// <returns></returns> public string setUserOrderLeavePay(string jsonArray) { JavaScriptSerializer ser = new JavaScriptSerializer(); setUserOrderLeavePayModel _modeljson = ser.Deserialize<setUserOrderLeavePayModel>(jsonArray); string username = _modeljson.userId; long orderid = long.Parse(_modeljson.orderList[0].id); int orderType = int.Parse(_modeljson.orderType); string pwd = _modeljson.payPwd; // 验证支付密码 PayService.PayService bll = new PayService.PayService(); bll.Url = System.Configuration.ConfigurationSettings.AppSettings["PayService"].ToString(); bool validPwd = bll.validPayPassword(username, pwd); if (validPwd == false) return "{ \"status\": \"0\", \"statusMsg\": \"支付密码错误!\", \"returnData\": \"\"}"; StreetOrderService.GoodsOrderService _orderService = new StreetOrderService.GoodsOrderService(); _orderService.Url = System.Configuration.ConfigurationSettings.AppSettings["StreetOrderService"].ToString(); string res = _orderService.CompletOrder(orderType, orderid); if (res == "success") return "{ \"status\": \"1\", \"statusMsg\": \"\", \"returnData\": \"\"}"; else return "{ \"status\": \"0\", \"statusMsg\": \"" + res + "\", \"returnData\": \"\"}"; }
/// <summary> /// 获取订单支付状态 /// </summary> /// <param name="jsonArray"></param> /// <returns></returns> public string getUserOrderPayStatus(string jsonArray) { JavaScriptSerializer ser = new JavaScriptSerializer(); getUserOrderPayStatusModel _modeljson = ser.Deserialize<getUserOrderPayStatusModel>(jsonArray); string username = _modeljson.userId; long orderid = long.Parse(_modeljson.orderList[0].id); int orderType = int.Parse(_modeljson.orderType); StreetOrderService.GoodsOrderService _orderService = new StreetOrderService.GoodsOrderService(); _orderService.Url = System.Configuration.ConfigurationSettings.AppSettings["StreetOrderService"].ToString(); int res = _orderService.getGoodsPayStatus(orderType, orderid); return "{ \"status\": \"1\", \"statusMsg\": \"\", \"returnData\": { \"orderList\":[{\"id\":\"" + orderid + "\",\"status\":\"" + res + "\"}] }}"; }
// 直接提交订单 // public string setUserBuyGoods(string jsonArray) { JavaScriptSerializer ser = new JavaScriptSerializer(); setUserBuyGoodsModel _Model = ser.Deserialize<setUserBuyGoodsModel>(jsonArray); StreetOrderService.GoodsOrderService _orderService = new StreetOrderService.GoodsOrderService(); _orderService.Url = System.Configuration.ConfigurationSettings.AppSettings["StreetOrderService"].ToString(); List<StreetOrderService.AddGoodsOrderListModel> modelList = new List<StreetOrderService.AddGoodsOrderListModel>(); StreetOrderService.AddGoodsOrderListModel _tempmodel = new StreetOrderService.AddGoodsOrderListModel(); _tempmodel.sellerId = long.Parse(_Model.sellerId); _tempmodel.transitId = int.Parse(_Model.transitId); _tempmodel.buyMemo = System.Web.HttpUtility.UrlDecode(_Model.buyMemo); _tempmodel.arrivePay = _Model.arrivePay; _tempmodel.receiveTel = _Model.receiveTel; List<StreetOrderService.AddGoodsOrderGoodsListModel> arrgoodsList = new List<StreetOrderService.AddGoodsOrderGoodsListModel>(); StreetOrderService.AddGoodsOrderGoodsListModel _goodsListModel = new StreetOrderService.AddGoodsOrderGoodsListModel(); _goodsListModel.goodsId = long.Parse(_Model.goodsId); _goodsListModel.attribId = int.Parse(_Model.attribId); _goodsListModel.numsBuy = int.Parse(_Model.numsBuy); arrgoodsList.Add(_goodsListModel); _tempmodel.goodsList = arrgoodsList.ToArray(); modelList.Add(_tempmodel); AddGoodsOrderListReturnResultModel resultModel = _orderService.AddGoodsOrder(_Model.userId, int.Parse(_Model.addressId), modelList.ToArray(), false); //var res = _orderService.AddGoodsOrder(_Model.userId, int.Parse(_Model.addressId), modelList.ToArray(), false); List<StreetOrderService.AddGoodsOrderListReturnModel> returnList = null; if (resultModel.result == "success") { if (resultModel._AddGoodsOrderListReturnModel != null) { returnList = resultModel._AddGoodsOrderListReturnModel.ToList(); } if (returnList != null && returnList.Count > 0) { string returnstr = "{ \"status\": \"1\", \"statusMsg\": \"\", \"returnData\": {"; returnstr += "\"orderId\":\"" + returnList[0].OrderId + "\",\"orderMoney\":\"" + returnList[0].allMoney + "\",\"orderScore\":\"" + returnList[0].allScore + "\""; returnstr += "}}"; return returnstr; } else { return "{ \"status\": \"0\", \"statusMsg\": \"无返回结果!!\", \"returnData\": \"\"}"; } } else { return "{ \"status\": \"0\", \"statusMsg\": \"" + resultModel.result + "\", \"returnData\": \"\"}"; } }
// 添加商品到购物车 逛逛去商品 // public string setMyShoppingCartAdd(string jsonArray) { JavaScriptSerializer ser = new JavaScriptSerializer(); setMyShoppingCartAddModel _setMyShoppingCartAddModel = ser.Deserialize<setMyShoppingCartAddModel>(jsonArray); string username = _setMyShoppingCartAddModel.userId; long goodsid = long.Parse(_setMyShoppingCartAddModel.goodsId); int nums = int.Parse(_setMyShoppingCartAddModel.numsBuy); int attrid = int.Parse(_setMyShoppingCartAddModel.attribId); StreetOrderService.GoodsOrderService _orderService = new StreetOrderService.GoodsOrderService(); _orderService.Url = System.Configuration.ConfigurationSettings.AppSettings["StreetOrderService"].ToString(); string res = _orderService.AddGoodsCar(username, goodsid, nums, attrid); if (res == "ok") return "{ \"status\": \"1\", \"statusMsg\": \"\", \"returnData\": \"\"}"; else return "{ \"status\": \"0\", \"statusMsg\": \"" + res + "\", \"returnData\": \"\"}"; }
// 提交逛逛去购物车 // public string setMyShopCartOrder(string jsonArray) { JavaScriptSerializer ser = new JavaScriptSerializer(); setMyShopCartOrderModel _Model = ser.Deserialize<setMyShopCartOrderModel>(jsonArray); StreetOrderService.GoodsOrderService _orderService = new StreetOrderService.GoodsOrderService(); _orderService.Url = System.Configuration.ConfigurationSettings.AppSettings["StreetOrderService"].ToString(); List<StreetOrderService.AddGoodsOrderListModel> modelList = new List<StreetOrderService.AddGoodsOrderListModel>(); foreach (setMyShopCartOrderModel.orderListModel orderList in _Model.orderList) { StreetOrderService.AddGoodsOrderListModel _tempmodel = new StreetOrderService.AddGoodsOrderListModel(); _tempmodel.sellerId = long.Parse(orderList.sellerId); _tempmodel.transitId = int.Parse(orderList.transitId); _tempmodel.buyMemo = orderList.buyMemo; _tempmodel.arrivePay = orderList.arrivePay; _tempmodel.receiveTel = orderList.receiveTel; List<StreetOrderService.AddGoodsOrderGoodsListModel> arrgoodsList = new List<StreetOrderService.AddGoodsOrderGoodsListModel>(); foreach (setMyShopCartOrderModel.orderListModel.goodsListModel goodsListTemp in orderList.goodsList) { StreetOrderService.AddGoodsOrderGoodsListModel _goodsListModel = new StreetOrderService.AddGoodsOrderGoodsListModel(); _goodsListModel.goodsId = long.Parse(goodsListTemp.goodsId); _goodsListModel.attribId = int.Parse(goodsListTemp.attribId); _goodsListModel.numsBuy = int.Parse(goodsListTemp.numsBuy); arrgoodsList.Add(_goodsListModel); _tempmodel.goodsList = arrgoodsList.ToArray(); } modelList.Add(_tempmodel); } AddGoodsOrderListReturnResultModel resultModel = _orderService.AddGoodsOrder(_Model.userId, int.Parse(_Model.addressId), modelList.ToArray(), true); List<StreetOrderService.AddGoodsOrderListReturnModel> returnList = null; if (resultModel.result == "success") { if (resultModel._AddGoodsOrderListReturnModel != null) { returnList = resultModel._AddGoodsOrderListReturnModel.ToList(); } if (returnList != null && returnList.Count > 0) { string returnstr = "{ \"status\": \"1\", \"statusMsg\": \"\", \"returnData\": {\"orderList\":["; foreach (StreetOrderService.AddGoodsOrderListReturnModel returnModel in returnList) { returnstr += "{\"id\":\"" + returnModel.OrderId + "\",\"money\":\"" + returnModel.allMoney + "\",\"score\":\"" + returnModel.allScore + "\"},"; } returnstr = returnstr.TrimEnd(','); returnstr += "]}}"; return returnstr; } else { return "{ \"status\": \"0\", \"statusMsg\": \"\", \"returnData\": \"\"}"; } } else { return "{ \"status\": \"0\", \"statusMsg\": \"" + resultModel.result + "\", \"returnData\": \"\"}"; } }
// 修改左右商城商品购物车中某商品购买属性(颜色,尺码和数量) // public string setMyGoodsShopCartAttrib(string jsonArray) { JavaScriptSerializer ser = new JavaScriptSerializer(); setMyGoodsShopCartAttribModel _Model = ser.Deserialize<setMyGoodsShopCartAttribModel>(jsonArray); StreetOrderService.GoodsOrderService _orderService = new StreetOrderService.GoodsOrderService(); _orderService.Url = System.Configuration.ConfigurationSettings.AppSettings["StreetOrderService"].ToString(); long itemid = long.Parse(_Model.itemId); int attribId = int.Parse(_Model.attribId); int nums = int.Parse(_Model.numsBuy); bool res = _orderService.SetGoodsCarAttrib(itemid, attribId, nums); if (res) return "{ \"status\": \"1\", \"statusMsg\": \"\", \"returnData\": \"\"}"; else return "{ \"status\": \"0\", \"statusMsg\": \"" + res + "\", \"returnData\": \"\"}"; }
// 查询商品物流费 // public string getGoodsTransitMoney(string jsonArray) { JavaScriptSerializer ser = new JavaScriptSerializer(); getGoodsTransitMoneyModel _Model = ser.Deserialize<getGoodsTransitMoneyModel>(jsonArray); StreetOrderService.GoodsOrderService _orderService = new StreetOrderService.GoodsOrderService(); _orderService.Url = System.Configuration.ConfigurationSettings.AppSettings["StreetOrderService"].ToString(); List<StreetOrderService.GetGoodsTransitMoneyModel> modelList = new List<StreetOrderService.GetGoodsTransitMoneyModel>(); foreach (getGoodsTransitMoneyModel.orderListModel orderList in _Model.orderList) { StreetOrderService.GetGoodsTransitMoneyModel _tempmodel = new StreetOrderService.GetGoodsTransitMoneyModel(); _tempmodel.id = orderList.id; List<StreetOrderService.goodsListModel> arrgoodsList = new List<StreetOrderService.goodsListModel>(); foreach (getGoodsTransitMoneyModel.orderListModel.goodsListModel goodsListTemp in orderList.goodsList) { StreetOrderService.goodsListModel _goodsListModel = new StreetOrderService.goodsListModel(); _goodsListModel.goodsId = long.Parse(goodsListTemp.goodsId); _goodsListModel.numsBuy = int.Parse(goodsListTemp.numsBuy); arrgoodsList.Add(_goodsListModel); _tempmodel.goodsList = arrgoodsList.ToArray(); } modelList.Add(_tempmodel); } string res = _orderService.GetGoodsTransitMoney(modelList.ToArray()); return "{ \"status\": \"1\", \"statusMsg\": \"\", \"returnData\": {" + res + "}}"; //else // return "{ \"status\": \"0\", \"statusMsg\": \"" + res + "\", \"returnData\": \"\"}"; }
// 删除购物车 逛逛去商品 // public string delMyGoodsShopCart(string jsonArray) { JavaScriptSerializer ser = new JavaScriptSerializer(); delMyGoodsShopCartModel _Model = ser.Deserialize<delMyGoodsShopCartModel>(jsonArray); StreetOrderService.GoodsOrderService _orderService = new StreetOrderService.GoodsOrderService(); _orderService.Url = System.Configuration.ConfigurationSettings.AppSettings["StreetOrderService"].ToString(); string itemids = ""; foreach (CartItem item in _Model.itemList) { itemids += item.itemId + ","; } itemids = itemids.TrimEnd(','); bool res = _orderService.DelGoodsCar(itemids); if (res) return "{ \"status\": \"1\", \"statusMsg\": \"\", \"returnData\": \"\"}"; else return "{ \"status\": \"0\", \"statusMsg\": \"" + res + "\", \"returnData\": \"\"}"; }