Просмотр исходного кода

Merge remote-tracking branch 'origin/develop' into develop

lin-jim-leon 4 дней назад
Родитель
Сommit
d947f5a974
1 измененных файлов с 16 добавлено и 10 удалено
  1. 16 10
      app/service/local_life_service.go

+ 16 - 10
app/service/local_life_service.go

@@ -770,19 +770,28 @@ func (s LocalLifeService) LocalLifeToReview(localUpdateParam *vo.LocalUpdatePara
 	}
 	storeName := store.StoreName     // 门店名称
 	storeDetail := store.StoreDetail // 门店特点
-	storeMainPhoto, err1 := dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(store.StoreID)
+	storeMainPhoto, err1 := dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(local.StoreID)
 	if err1 != nil {
 		return nil, err1
 	}
+	var teamBuyingName, teamBuyingDetail, teamBuyingMainPhoto string
+	var teamBuyingPhotos []entity.ProductPhoto
 	teamBuying, err2 := dao.TeamBuyingDao{}.GetTeamBuyingByID(local.TeamBuyingId)
 	if err2 != nil {
 		return nil, err2
 	}
-	teamBuyingName := teamBuying.TeamBuyingName     // 团购标题
-	teamBuyingDetail := teamBuying.TeamBuyingDetail // 团购详情
-	teamBuyingMainPhoto, err3 := dao.ProductPhotoDAO{}.GetMainPhotoByTeamBuyingID(teamBuying.TeamBuyingID)
-	if err3 != nil {
-		return nil, err3
+	var err3, err5 error
+	if teamBuying != nil {
+		teamBuyingName = teamBuying.TeamBuyingName     // 团购标题
+		teamBuyingDetail = teamBuying.TeamBuyingDetail // 团购详情
+		teamBuyingMainPhoto, err3 = dao.ProductPhotoDAO{}.GetMainPhotoByTeamBuyingID(local.TeamBuyingId)
+		if err3 != nil {
+			return nil, err3
+		}
+		teamBuyingPhotos, err5 = dao.ProductPhotoDAO{}.GetProductPhotoByTeamBuyingID(local.TeamBuyingId)
+		if err5 != nil {
+			return nil, err5
+		}
 	}
 	var images []string
 	var videos []string
@@ -816,10 +825,7 @@ func (s LocalLifeService) LocalLifeToReview(localUpdateParam *vo.LocalUpdatePara
 			videoJobIds = append(videoJobIds, *videoJobId)
 		}
 	}
-	teamBuyingPhotos, err5 := dao.ProductPhotoDAO{}.GetProductPhotoByTeamBuyingID(local.TeamBuyingId)
-	if err5 != nil {
-		return nil, err5
-	}
+
 	for _, teamBuyingPhoto := range teamBuyingPhotos {
 		if teamBuyingPhoto.Symbol == 2 || teamBuyingPhoto.Symbol == 4 {
 			images = append(images, teamBuyingPhoto.PhotoUrl)