public JsonResult BuyAjax(string orderId, string price, string voucherId) { int oId = Utility.Util.ParseHelper.ToInt(orderId); pbs_basic_OrderService pbsBasicOrderService = new pbs_basic_OrderService(); ResultInfo <bool> result_UpdateOrder = pbsBasicOrderService.UpdateOrders(2, Utility.Util.ParseHelper.ToDecimal(price), Utility.Util.ParseHelper.ToInt(voucherId), oId); if (result_UpdateOrder.Result && result_UpdateOrder.Data) { return(Json(new ResultModel <bool>(0, "购买成功", true), JsonRequestBehavior.AllowGet)); } return(Json(new ResultModel <bool>(1, "购买失败", true), JsonRequestBehavior.AllowGet)); }
public JsonResult ApplyMoneyAjax(string orderId, string reason) { int oId = Utility.Util.ParseHelper.ToInt(orderId); pbs_basic_OrderRefundService pbsBasicOrderRefundService = new pbs_basic_OrderRefundService(); pbs_basic_OrderService pbsBasicOrderService = new pbs_basic_OrderService(); ResultInfo <bool> result_AddOrderRefun = pbsBasicOrderRefundService.AddOrderRefund(oId, userid, reason, DateTime.Now, DateTime.Now, 0, string.Empty); if (result_AddOrderRefun.Result && result_AddOrderRefun.Data) { ResultInfo <bool> result_UpdateOrder = pbsBasicOrderService.UpdateOrders(4, oId); if (result_AddOrderRefun.Result && result_AddOrderRefun.Data) { return(Json(new ResultModel <bool>(0, "退款已申请", true), JsonRequestBehavior.AllowGet)); } } return(Json(new ResultModel <bool>(1, "申请退款失败", true), JsonRequestBehavior.AllowGet)); }
public JsonResult AssessOrderAjax(string goodsId, string commentContents, string url1, string score, string oId) { int gId = Utility.Util.ParseHelper.ToInt(goodsId); int scoreThis = Utility.Util.ParseHelper.ToInt(score); pbs_basic_CommentService pbsBasicCommentService = new pbs_basic_CommentService(); pbs_basic_OrderService pbsBasicOrderService = new pbs_basic_OrderService(); ResultInfo <bool> result_AddComment = pbsBasicCommentService.AddComment(gId, userid, commentContents, url1, string.Empty, string.Empty, string.Empty, string.Empty, scoreThis, DateTime.Now, DateTime.Now, 0, string.Empty); if (result_AddComment.Result && result_AddComment.Data) { ResultInfo <bool> result_UpdateOrder = pbsBasicOrderService.UpdateOrders(6, Utility.Util.ParseHelper.ToInt(oId)); if (result_UpdateOrder.Result && result_UpdateOrder.Data) { return(Json(new ResultModel <bool>(0, "评论成功", true), JsonRequestBehavior.AllowGet)); } } return(Json(new ResultModel <bool>(1, "评论失败", true), JsonRequestBehavior.AllowGet)); }
public ActionResult PaySuccess(string billNo) { if (!string.IsNullOrEmpty(billNo)) { int oId = Utility.Util.ParseHelper.ToInt(billNo); int gid = 0; decimal orderPrice = 0; string goodsMainImgUrl = string.Empty; string goodsName = string.Empty; pbs_basic_Order order = new pbs_basic_Order(); pbs_basic_OrderService pbsBasicOrderService = new pbs_basic_OrderService(); pbs_basic_GoodsService pbsBasicGoodsService = new pbs_basic_GoodsService(); pbs_basic_MyVoucherService pbsBasicMyVoucherService = new pbs_basic_MyVoucherService(); pbs_basic_VoucherService pbsBasicVoucherService = new pbs_basic_VoucherService(); ResultInfo <bool> result_UpdateOrder = pbsBasicOrderService.UpdateOrders(2, oId); if (result_UpdateOrder.Result && result_UpdateOrder.Data) { ResultInfo <pbs_basic_Order> result_order = pbsBasicOrderService.GetOrderModelById(oId); if (result_order.Result && result_order.Data != null) { gid = result_order.Data.GoodsId; orderPrice = result_order.Data.OrderPrice; ResultInfo <pbs_basic_GoodsView> result = pbsBasicGoodsService.GetGoodsModelViewById(gid); if (result.Result && result.Data != null) { goodsMainImgUrl = result.Data.GoodsMainImgUrl; goodsName = result.Data.GoodsName; } //减少活动数量 ResultInfo <bool> result_updateGoodsCount = pbsBasicGoodsService.UpdateGoodsCountMinus(result_order.Data.GoodsId); //更新优惠券使用 ResultInfo <bool> result_UpdateMyVoucherIsUsed = pbsBasicMyVoucherService.UpdateMyVoucherIsUsed(1, result_order.Data.VoucherId); if (result_order.Data.VoucherId != 0) { ResultInfo <pbs_basic_Voucher> result_Voucher = pbsBasicVoucherService.GetVoucherModelById(result_order.Data.VoucherId); if (result_Voucher.Result && result_Voucher.Data != null) { orderPrice = orderPrice - result_Voucher.Data.VoucherPrice; //更新订单价格 ResultInfo <bool> result_UpdateOrderPrice = pbsBasicOrderService.UpdateOrderPrice(orderPrice, oId); } } } } ViewData["OrderPrice"] = orderPrice; #region 分销 if (!string.IsNullOrEmpty(FromShareUserId)) { FXMethod(gid, oId, orderPrice); } #endregion //#region 微信分享 //string token = string.Empty; //string ticket = string.Empty; //string timestamp = string.Empty; //string nonceStr = string.Empty; //string signature = string.Empty; //if (Session["Token"] != null && Session["TokenTime"] != null) //{ // DateTime dt1 = DateTime.Now; // DateTime dt2 = Utility.Util.ParseHelper.ToDatetime(Session["TokenTime"].ToString()); // TimeSpan ts = dt1 - dt2; // string tsSen = ts.Seconds.ToString(); // if (Utility.Util.ParseHelper.ToInt(tsSen) < 7200) // { // token = Session["Token"].ToString(); // ticket = Session["Ticket"].ToString(); // timestamp = Session["TimeStamp"].ToString(); // nonceStr = Session["NonceStr"].ToString(); // //signature = Session["SigNature"].ToString(); // signature = JSSDKHelper.GetSignature(ticket, nonceStr, timestamp, Request.Url.AbsoluteUri); // LogUtil.WriteLog("tsSen:" + tsSen); // LogUtil.WriteLog("Session Token:" + token); // LogUtil.WriteLog("Session Ticket:" + ticket); // LogUtil.WriteLog("Session TimeStamp:" + timestamp); // LogUtil.WriteLog("Session NonceStr:" + nonceStr); // LogUtil.WriteLog("Session SigNature:" + signature); // } //} //if (string.IsNullOrEmpty(token)) //{ // #region 获取token // string token_url = string.Format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}", PayConfig.AppId, PayConfig.AppSecret); // string returnToken = HttpUtil.Send("", token_url); // var tokenModel = JsonConvert.DeserializeObject<tokenModel>(returnToken); // token = tokenModel.access_token; // #endregion // #region 获取ticket // string ticket_url = string.Format("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={0}&type=jsapi", token); // string returnTicket = HttpUtil.Send("", ticket_url); // var ticketModel = JsonConvert.DeserializeObject<ticketModel>(returnTicket); // ticket = ticketModel.ticket; // #endregion // //获取时间戳 // timestamp = JSSDKHelper.GetTimestamp(); // //获取随机码 // nonceStr = JSSDKHelper.GetNoncestr(); // //获取签名 // signature = JSSDKHelper.GetSignature(ticket, nonceStr, timestamp, Request.Url.AbsoluteUri); // Session["Token"] = token; // Session["TokenTime"] = DateTime.Now; // Session["Ticket"] = ticket; // Session["TimeStamp"] = timestamp; // Session["NonceStr"] = nonceStr; // //Session["SigNature"] = signature; // LogUtil.WriteLog("First Ticket:" + ticket); // LogUtil.WriteLog("First TimeStamp:" + timestamp); // LogUtil.WriteLog("First NonceStr:" + nonceStr); // LogUtil.WriteLog("First SigNature:" + signature); // LogUtil.WriteLog("Request Url:" + Request.Url.AbsoluteUri); //} //ViewData["AppId"] = PayConfig.AppId; //ViewData["Timestamp"] = timestamp; //ViewData["NonceStr"] = nonceStr; //ViewData["Signature"] = signature; //#endregion } return(View()); }
public ActionResult MyOrder() { List <pbs_basic_OrderView> listAllOrder = new List <pbs_basic_OrderView>(); List <pbs_basic_OrderView> listDFKOrder = new List <pbs_basic_OrderView>(); List <pbs_basic_OrderView> listYFKOrder = new List <pbs_basic_OrderView>(); List <pbs_basic_OrderView> listTKZOrder = new List <pbs_basic_OrderView>(); List <pbs_basic_OrderView> listYWCOrder = new List <pbs_basic_OrderView>(); pbs_basic_OrderService pbsBasicOrderService = new pbs_basic_OrderService(); //全部 ResultInfo <List <pbs_basic_OrderView> > result_listAllOrder = pbsBasicOrderService.GetOrderViewListByUserId(userid); if (result_listAllOrder.Result && result_listAllOrder.Data != null) { listAllOrder = result_listAllOrder.Data; foreach (var item in listAllOrder) { if (item.OrderStatus == 2 && item.VisitTime < DateTime.Now) { pbsBasicOrderService.UpdateOrders(3, item.OrderId); } } } //待付款 ResultInfo <List <pbs_basic_OrderView> > result_listDFKOrder = pbsBasicOrderService.GetOrderViewListByUserIdAndStatus(userid, 1); if (result_listDFKOrder.Result && result_listDFKOrder.Data != null) { listDFKOrder = result_listDFKOrder.Data; } //已付款 ResultInfo <List <pbs_basic_OrderView> > result_listYFKOrder = pbsBasicOrderService.GetOrderViewListByUserIdAndStatus(userid, 2); if (result_listYFKOrder.Result && result_listYFKOrder.Data != null) { listYFKOrder = result_listYFKOrder.Data; } //已完成 ResultInfo <List <pbs_basic_OrderView> > result_listYWCOrder = pbsBasicOrderService.GetOrderViewListByUserIdAndStatus(userid, 3); if (result_listYWCOrder.Result && result_listYWCOrder.Data != null) { listYWCOrder = result_listYWCOrder.Data; } //退款中 ResultInfo <List <pbs_basic_OrderView> > result_listTKZOrder = pbsBasicOrderService.GetOrderViewListByUserIdAndStatus(userid, 4); if (result_listTKZOrder.Result && result_listTKZOrder.Data != null) { listTKZOrder = result_listTKZOrder.Data; } ViewData["ListAllOrder"] = listAllOrder; ViewData["ListDFKOrder"] = listDFKOrder; ViewData["ListYFKOrder"] = listYFKOrder; ViewData["ListTKZOrder"] = listTKZOrder; ViewData["ListYWCOrder"] = listYWCOrder; return(View()); }