Exemple #1
0
        public async Task <BaseApiResponse> EditStatus(EditStatusRequest request)
        {
            request.CheckNotNull(nameof(request));

            var store = _storeQueryService.Info(request.Id);

            if (store == null)
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "未找到店铺"
                });
            }
            var command = new UpdateStoreStautsCommand(
                request.Status)
            {
                AggregateRootId = request.Id
            };

            var result = await ExecuteCommandAsync(command);

            if (!result.IsSuccess())
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage())
                });
            }
            //添加操作记录
            var currentAdmin = _contextService.GetCurrentAdmin(HttpContext.Current);

            RecordOperat(currentAdmin.AdminId.ToGuid(), "编辑店铺状态", request.Id, "{0}=>{1}".FormatWith(store.Status.ToDescription(), request.Status.ToDescription()));
            return(new BaseApiResponse());
        }
Exemple #2
0
        public BaseApiResponse ReturnAddressInfo([FromBody] ReturnAddressInfoRequest request)
        {
            request.CheckNotNull(nameof(request));
            var storeInfo = _storeQueryService.Info(request.Id);

            if (storeInfo == null)
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "没有店铺"
                });
            }

            return(new ReturnAddressInfoResponse
            {
                ReturnAddressInfo = new ReturnAddressInfo
                {
                    StoreId = storeInfo.Id,
                    ReturnAddress = storeInfo.ReturnAddress,
                    ReturnAddressMobile = storeInfo.ReturnAddressMobile,
                    ReturnAddressName = storeInfo.ReturnAddressName
                }
            });
        }
Exemple #3
0
        public BaseApiResponse GoodsInfo(InfoRequest request)
        {
            request.CheckNotNull(nameof(request));

            var goodsDetails   = _goodsQueryService.GetGoodsDetails(request.Id);
            var storeInfo      = _storeQueryService.Info(goodsDetails.StoreId);
            var specifications = _goodsQueryService.GetPublishedSpecifications(request.Id);
            var goodsParams    = _goodsQueryService.GetGoodsParams(request.Id);
            var comments       = _goodsQueryService.GetComments(request.Id, 5);

            if (goodsDetails == null)
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "没有该产品"
                });
            }
            return(new GoodsInfoResponse
            {
                GoodsDetails = new GoodsDetails
                {
                    Id = goodsDetails.Id,
                    StoreId = goodsDetails.StoreId,
                    Pics = goodsDetails.Pics.Split("|", true).Select(img => img.ToOssStyleUrl(OssImageStyles.GoodsMainPic.ToDescription())).ToList(),
                    Name = goodsDetails.Name,
                    Description = goodsDetails.Description,
                    Benevolence = goodsDetails.Benevolence,
                    Price = goodsDetails.Price,
                    OriginalPrice = goodsDetails.OriginalPrice,
                    Stock = goodsDetails.Stock,
                    Is7SalesReturn = goodsDetails.Is7SalesReturn,
                    IsInvoice = goodsDetails.IsInvoice,
                    IsPayOnDelivery = goodsDetails.IsPayOnDelivery,
                    Rate = goodsDetails.Rate,
                    QualityRate = goodsDetails.QualityRate,
                    ExpressRate = goodsDetails.ExpressRate,
                    DescribeRate = goodsDetails.DescribeRate,
                    PriceRate = goodsDetails.PriceRate,
                    RateCount = goodsDetails.RateCount,
                    Sort = goodsDetails.Sort,
                    IsPublished = goodsDetails.IsPublished,
                    Status = goodsDetails.Status.ToString()
                },
                StoreInfo = new StoreInfo
                {
                    Id = storeInfo.Id,
                    Name = storeInfo.Name,
                    Description = storeInfo.Description,
                    Type = storeInfo.Type.ToDescription(),
                    Address = storeInfo.Address,
                    IsLocked = storeInfo.IsLocked
                },
                Specifications = specifications.Select(x => new Specification {
                    Id = x.Id,
                    Name = x.Name,
                    Value = x.Value,
                    Price = x.Price,
                    OriginalPrice = x.OriginalPrice,
                    Benevolence = x.Benevolence,
                    Thumb = x.Thumb,
                    Stock = x.Stock,
                    BarCode = x.BarCode,
                    Number = x.Number,
                    AvailableQuantity = x.AvailableQuantity
                }).ToList(),
                GoodsParams = goodsParams.Select(x => new GoodsParam {
                    Id = x.Id,
                    Name = x.Name,
                    Value = x.Value
                }).ToList(),
                Comments = comments.Select(x => new Comment {
                    Id = x.Id,
                    Rate = x.Rate,
                    NickName = x.NickName,
                    CreatedOn = x.CreatedOn.GetTimeSpan(),
                    Thumbs = x.Thumbs.Split("|", true).ToList(),
                    Body = x.Body
                }).ToList()
            });
        }