Пример #1
0
        public JsonResult SubmitOrder(CommonModel.OrderPostModel model)
        {
            model.CurrentUser            = CurrentUser;
            model.DistributionUserLinkId = GetDistributionUserLinkId();
            model.PlatformType           = (int)PlatformType.PC;

            var result = OrderApplication.SubmitOrder(model);

            ClearDistributionUserLinkId();               //清理分销cookie
            return(Json(new { success = result.Success, orderIds = result.OrderIds, redirect = result.OrderTotal > 0 }));
        }
Пример #2
0
        public JsonResult SubmitOrder(CommonModel.OrderPostModel model)
        {
            model.CurrentUser            = CurrentUser;
            model.DistributionUserLinkId = GetDistributionUserLinkId();
            model.PlatformType           = PlatformType.GetHashCode();

            var result = OrderApplication.SubmitOrder(model);

            ClearDistributionUserLinkId();   //清理分销cookie
            OrderApplication.AddVshopBuyNumber(result.OrderIds);
            Session.Remove("OrderTag");
            return(Json(new { success = result.Success, orderIds = result.OrderIds, realTotalIsZero = result.OrderTotal == 0 }));
        }
Пример #3
0
        public JsonResult SubmitLimitOrder(CommonModel.OrderPostModel model)
        {
            model.CurrentUser  = CurrentUser;
            model.PlatformType = (int)PlatformType.PC;
            var result = OrderApplication.GetLimitOrder(model);

            if (LimitOrderHelper.IsRedisCache())
            {
                string            id = "";
                SubmitOrderResult r  = LimitOrderHelper.SubmitOrder(result, out id);
                if (r == SubmitOrderResult.SoldOut)
                {
                    throw new HimallException("已售空");
                }
                else if (r == SubmitOrderResult.NoSkuId)
                {
                    throw new InvalidPropertyException("创建订单的时候,SKU为空,或者数量为0");
                }
                else if (r == SubmitOrderResult.NoData)
                {
                    throw new InvalidPropertyException("参数错误");
                }
                else if (r == SubmitOrderResult.NoLimit)
                {
                    throw new InvalidPropertyException("没有限时购活动");
                }
                else if (string.IsNullOrEmpty(id))
                {
                    throw new InvalidPropertyException("参数错误");
                }
                else
                {
                    OrderApplication.UpdateDistributionUserLink(GetDistributionUserLinkId().ToArray(), UserId);
                    return(Json(new { success = true, Id = id }));
                }
            }
            else
            {
                var orderIds = OrderApplication.OrderSubmit(result);
                return(Json(new { success = true, orderIds = orderIds }));
            }
        }
Пример #4
0
        public JsonResult SubmitOrder(CommonModel.OrderPostModel model, string payPwd)
        {
            model.CurrentUser  = CurrentUser;
            model.PlatformType = (int)PlatformType.PC;
            if (string.IsNullOrEmpty(model.LatAndLng))
            {
                model.LatAndLng = "0,0";
            }
            var result = OrderApplication.SubmitOrder(model, payPwd);

            #region 处理虚拟订单项
            if (model.ProductType == 1 && model.VirtualProductItems != null && model.VirtualProductItems.Count() > 0)
            {
                var orderId = result.OrderIds.FirstOrDefault();
                if (orderId > 0)
                {
                    var orderItemInfo = OrderApplication.GetOrderItemsByOrderId(orderId).FirstOrDefault();
                    if (orderItemInfo != null)
                    {
                        var list = model.VirtualProductItems.ToList().Where(a => !string.IsNullOrWhiteSpace(a.Content)).ToList();//过滤空项
                        list.ForEach(a =>
                        {
                            a.OrderId     = orderId;
                            a.OrderItemId = orderItemInfo.Id;
                            if (a.VirtualProductItemType == (sbyte)Mall.Entities.ProductInfo.VirtualProductItemType.Picture)
                            {
                                a.Content = MoveImages(a.Content, CurrentUser.Id);
                            }
                        });
                        if (list.Count > 0)
                        {
                            OrderApplication.AddVirtualOrderItemInfo(list);
                        }
                    }
                }
            }
            #endregion

            return(Json(new { success = result.Success, orderIds = result.OrderIds, redirect = result.OrderTotal > 0 }));
        }