Himall商城- web私有方法

目录

1 Himall商城- web私有方法

1.1 /// 根据订单ID获取订单商品明细,包括商品店铺信息

1.1.1 //微店信息

1.1.2 //完善图片地址

  1. Himall商城- web私有方法

   #region web私有方法

        ///

    1.         /// 根据订单ID获取订单商品明细,包括商品店铺信息

        ///

        ///

        ///

        public static List GetOrderDetailViews(IEnumerable ids)

        {

            var list = _iOrderService.GetOrders(ids).Map>();

            List orderDetails = new List();

            var orderItems = GetOrderItemsByOrderId(list.Select(p => p.Id));//订单明细

            var shops = ShopApplication.GetShops(orderItems.Select(e => e.ShopId));//店铺信息

            var shopbranchs = ShopBranchApplication.GetShopBranchByIds(list.Where(d => d.ShopBranchId.HasValue && d.ShopBranchId > 0).Select(d => d.ShopBranchId.Value));

            var vShops = VshopApplication.GetVShopsByShopIds(orderItems.Select(e => e.ShopId));

      1. //微店信息

            foreach (var orderItem in orderItems)

            {

      1.                 //完善图片地址

                string s_pimg = orderItem.ThumbnailsUrl;

                orderItem.ThumbnailsUrl = HimallIO.GetRomoteProductSizeImage(s_pimg, 1, (int)ImageSize.Size_500);

                orderItem.ProductImage = HimallIO.GetRomoteProductSizeImage(s_pimg, 1, (int)ImageSize.Size_100);

                orderItem.ShareImage = HimallIO.GetRomoteProductSizeImage(s_pimg, 1, (int)ImageSize.Size_50);

            }

            foreach (var item in list)

            {

                OrderDetailView detail = new OrderDetailView() { };

                var vshop = vShops.FirstOrDefault(e => e.ShopId == item.ShopId);

                long vshopId = 0;

                if (vshop != null)

                {

                    vshopId = vshop.Id;

                }

                detail.Detail = new OrderDetail

                {

                    ShopId = item.ShopId,

                    ShopName = shops.FirstOrDefault(e => e.Id == item.ShopId).ShopName,

                    VShopId = vshopId,

                    OrderItems = orderItems.Where(p => p.OrderId == item.Id).ToList()

                };

                if (item.ShopBranchId.HasValue && item.ShopBranchId > 0)

                {

                    var sb = shopbranchs.FirstOrDefault(d => d.Id == item.ShopBranchId.Value);

                    if (sb != null)

                    {

                        detail.Detail.ShopBranchName = sb.ShopBranchName;

                        detail.Detail.ShopBranchId = sb.Id;

                    }

                }

                detail.Order = item.Map();

                orderDetails.Add(detail);

            }

            return orderDetails;

        }

        #endregion

你可能感兴趣的:(windows)