Example #1
0
        public JsonResult SubmitLimitOrder(OrderPostModel model, string payPwd)
        {
            model.CurrentUser = CurrentUser;
            var result = OrderApplication.GetLimitOrder(model);

            result.PlatformType = PlatformType; //订单来源
                                                //delete-pengjiangxiong
                                                //if (LimitOrderHelper.IsRedisCache())
                                                //{
                                                //    string id = "";
                                                //    SubmitOrderResult r = LimitOrderHelper.SubmitOrder(result, out id, payPwd);
                                                //    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 (r == SubmitOrderResult.ErrorPassword)
                                                //        throw new InvalidPropertyException("支付密码错误");
                                                //    else if (string.IsNullOrEmpty(id))
                                                //        throw new InvalidPropertyException("参数错误");
                                                //    else
                                                //    {
                                                //        return SuccessResult<dynamic>(data: id);
                                                //    }
                                                //}
                                                //else
                                                //{
            var ret = OrderApplication.OrderSubmit(result, payPwd);

            return(Json <dynamic>(ret.Success, data: new { orderIds = ret.OrderIds, realTotalIsZero = ret.OrderTotal == 0 }));
            //}
        }
Example #2
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 }));
            }
        }
Example #3
0
        public JsonResult SubmitLimitOrder(OrderPostModel model, string payPwd)
        {
            model.CurrentUser  = base.CurrentUser;
            model.PlatformType = 1;
            OrderCreateModel limitOrder = OrderApplication.GetLimitOrder(model);

            if (LimitOrderHelper.IsRedisCache())
            {
                string id = "";
                switch (LimitOrderHelper.SubmitOrder(limitOrder, out id, payPwd))
                {
                case SubmitOrderResult.SoldOut:
                    throw new HimallException("已售空");

                case SubmitOrderResult.NoSkuId:
                    throw new InvalidPropertyException("创建预约单的时候,SKU为空,或者数量为0");

                case SubmitOrderResult.NoData:
                    throw new InvalidPropertyException("参数错误");

                case SubmitOrderResult.NoLimit:
                    throw new InvalidPropertyException("没有限时购活动");

                case SubmitOrderResult.ErrorPassword:
                    throw new InvalidPropertyException("支付密码错误");
                }
                if (string.IsNullOrEmpty(id))
                {
                    throw new InvalidPropertyException("参数错误");
                }
                OrderApplication.UpdateDistributionUserLink(base.GetDistributionUserLinkId().ToArray(), base.UserId);
                return(base.Json(new { success = true, Id = id }));
            }
            OrderReturnModel model3 = OrderApplication.OrderSubmit(limitOrder, payPwd);

            return(base.Json(new { success = model3.Success, orderIds = model3.OrderIds, realTotalIsZero = model3.OrderTotal == 0M }));
        }