Parcourir la source

fix_门店&团购管理

Ethan il y a 3 mois
Parent
commit
a2066c258e

+ 4 - 4
app/service/selection_info_service.go

@@ -688,7 +688,7 @@ func (s SelectionInfoService) GetSelectionTaskList(param *vo.SelectionSearchPara
 		return result, err
 	}
 	for i := range reSelectionTaskPreviews {
-		var creatorName string
+		var createrName string
 		var productName string
 		var productPrice float64
 		var mainImage string
@@ -696,12 +696,12 @@ func (s SelectionInfoService) GetSelectionTaskList(param *vo.SelectionSearchPara
 		if reSelectionTaskPreviews[i].SubAccountId == 0 {
 			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reSelectionTaskPreviews[i].EnterpriseId)
 			if err == nil && enterprise != nil {
-				creatorName = enterprise.BusinessName
+				createrName = enterprise.BusinessName
 			}
 		} else {
 			subAccount, err := dao.SubAccountDao{}.GetSubAccount(reSelectionTaskPreviews[i].SubAccountId)
 			if err == nil && subAccount != nil {
-				creatorName = subAccount.SubAccountName
+				createrName = subAccount.SubAccountName
 			}
 		}
 		product, err := dao.ProductDAO{}.GetProductByID(reSelectionTaskPreviews[i].ProductId)
@@ -722,7 +722,7 @@ func (s SelectionInfoService) GetSelectionTaskList(param *vo.SelectionSearchPara
 		//	reward += rewardStrategy.Reward
 		//}
 		//reSelectionTaskPreviews[i].Reward = reward
-		reSelectionTaskPreviews[i].CreatorName = creatorName
+		reSelectionTaskPreviews[i].CreatorName = createrName
 		reSelectionTaskPreviews[i].ProductName = productName
 		reSelectionTaskPreviews[i].ProductPrice = productPrice
 		reSelectionTaskPreviews[i].MainImage = mainImage

+ 15 - 0
app/service/store_service.go

@@ -10,6 +10,7 @@ import (
 
 type StoreService struct{}
 
+// 获取某商家下的所有门店
 func (p StoreService) GetStoresByEnterpriseId(param vo.GetAllStoreParam) (vo.ResultVO, error) {
 	if param.Page == 0 {
 		param.Page = 1
@@ -31,8 +32,20 @@ func (p StoreService) GetStoresByEnterpriseId(param vo.GetAllStoreParam) (vo.Res
 		return result, err
 	}
 	var reStores []vo.ReStorePreview
+	var creatorName string
 	for _, store := range stores {
 		photoUrl, e := dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(store.StoreID)
+		if store.SubAccountID == 0 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(store.EnterpriseID)
+			if err == nil && enterprise != nil {
+				creatorName = enterprise.BusinessName
+			}
+		} else {
+			subAccount, err := dao.SubAccountDao{}.GetSubAccount(store.SubAccountID)
+			if err == nil && subAccount != nil {
+				creatorName = subAccount.SubAccountName
+			}
+		}
 		if e != nil {
 			photoUrl = ""
 		}
@@ -46,6 +59,7 @@ func (p StoreService) GetStoresByEnterpriseId(param vo.GetAllStoreParam) (vo.Res
 			StoreDetail:   store.StoreDetail,
 			CreatedAt:     store.CreatedAt.Format("2006-01-02 15:04:05"),
 			PhotoUrl:      photoUrl,
+			CreateName:    creatorName,
 		}
 		reStores = append(reStores, reStore)
 	}
@@ -126,6 +140,7 @@ func (s StoreService) GetStoreDetail(param *vo.StoreSearchParam) (*vo.ReStoreInf
 	}
 	reStoreInfo = &vo.ReStoreInfo{
 		StoreID:       store.StoreID,
+		StoreLink:     store.StoreLink,
 		StoreName:     store.StoreName,
 		StoreCategory: store.StoreCategory,
 		StoreType:     store.StoreType,

+ 13 - 0
app/service/teambuying_service.go

@@ -28,10 +28,22 @@ func (p TeamBuyingService) GetTeamBuyingsByStoreId(param vo.GetAllTeamBuyingPara
 	}
 	var reTeamBuyings []vo.ReTeamBuyingPreview
 	for _, teamBuying := range teamBuyings {
+		var createrName string
 		photoUrl, e := dao.ProductPhotoDAO{}.GetMainPhotoByTeamBuyingID(teamBuying.TeamBuyingID)
 		if e != nil {
 			photoUrl = ""
 		}
+		if teamBuying.SubAccountID == 0 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(teamBuying.EnterpriseID)
+			if err == nil && enterprise != nil {
+				createrName = enterprise.BusinessName
+			}
+		} else {
+			subAccount, err := dao.SubAccountDao{}.GetSubAccount(teamBuying.SubAccountID)
+			if err == nil && subAccount != nil {
+				createrName = subAccount.SubAccountName
+			}
+		}
 		reTeamBuying := vo.ReTeamBuyingPreview{
 			TeamBuyingID:       teamBuying.TeamBuyingID,
 			TeamBuyingName:     teamBuying.TeamBuyingName,
@@ -40,6 +52,7 @@ func (p TeamBuyingService) GetTeamBuyingsByStoreId(param vo.GetAllTeamBuyingPara
 			TeamBuyingDetail:   teamBuying.TeamBuyingDetail,
 			CreatedAt:          teamBuying.CreatedAt.Format("2006-01-02 15:04:05"),
 			PhotoUrl:           photoUrl,
+			CreateName:         createrName,
 		}
 		reTeamBuyings = append(reTeamBuyings, reTeamBuying)
 	}

+ 1 - 0
app/vo/re_store_info.go

@@ -2,6 +2,7 @@ package vo
 
 type ReStoreInfo struct {
 	StoreID       int64   `json:"storeId"`
+	StoreLink     string  `json:"storeLink"` // 分销链接
 	StoreName     string  `json:"storeName"`
 	StoreCategory string  `json:"storeCategory"` // 门店类目
 	StoreType     int64   `json:"storeType"`     // 门店类型 1单门店,2连锁门店

+ 1 - 0
app/vo/re_store_preview.go

@@ -7,6 +7,7 @@ type ReStorePreview struct {
 	StoreType     int64  `json:"storeType"`     // 门店类型 1单门店,2连锁门店
 	StoreCategory string `json:"storeCategory"` // 门店类目
 	TeamNum       int64  `json:"teamNum"`       // 包含团购套餐
+	CreateName    string `json:"createName"`    // 创建者
 	StoreDetail   string `json:"storeDetail"`
 	CreatedAt     string `json:"createdAt"`
 	PhotoUrl      string `json:"photoUrl"`

+ 1 - 0
app/vo/re_teambuying_preview.go

@@ -8,4 +8,5 @@ type ReTeamBuyingPreview struct {
 	TeamBuyingDetail   string  `json:"teamBuyingDetail"`
 	CreatedAt          string  `json:"createdAt"`
 	PhotoUrl           string  `json:"photoUrl"`
+	CreateName         string  `json:"createName"`
 }