目录
1 Himall商城- web私有方法
1.1 /// 根据订单ID获取订单商品明细,包括商品店铺信息
1.1.1 //微店信息
1.1.2 //完善图片地址
#region web私有方法
///
///
///
///
public static List
{
var list = _iOrderService.GetOrders(ids).Map>();
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));
foreach (var orderItem in orderItems)
{
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