diff --git a/SiNan.Business/GOIBusiness.cs b/SiNan.Business/GOIBusiness.cs index 8467799..2afeb14 100644 --- a/SiNan.Business/GOIBusiness.cs +++ b/SiNan.Business/GOIBusiness.cs @@ -380,7 +380,8 @@ namespace SiNan.Business Recent30dProductLevelProfit = ap.Recent30dProductLevelProfit, Date = ap.Date, UpdateTime = ap.UpdateTime, - MaxDeficitThreshold = p.MaxDeficitThreshold + MaxDeficitThreshold = p.MaxDeficitThreshold, + MainSkuId = p.MainSkuId }).Map>(); var productIdList = productList.Select(p => p.Id).ToList(); @@ -392,7 +393,12 @@ namespace SiNan.Business foreach (var product in productList) { var currentProductSkuIdList = skuList.Where(s => s.ProductId == product.Id).Select(s => s.Id).ToList(); - var firstSku = skuList.FirstOrDefault(s => currentProductSkuIdList.Contains(s.Id)); + + ProductSku firstSku = null; + if (!string.IsNullOrEmpty(product.MainSkuId)) + firstSku = skuList.FirstOrDefault(s => s.Id == product.MainSkuId); + if (firstSku == null) + firstSku = skuList.FirstOrDefault(s => currentProductSkuIdList.Contains(s.Id)); product.Logo = firstSku?.Logo; product.MainSkuId = firstSku?.Id; var currentProductHistoryPopularizeLevelGOIList = historyPopularizeLevelGOIList.Where(x => currentProductSkuIdList.Contains(x.Sku));