A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: add tag common service to controller
LinkinStar747323b49c8c
diff --git a/cmd/answer/wire_gen.go b/cmd/answer/wire_gen.goindex d8ea06b3..8c88552f 100644--- a/cmd/answer/wire_gen.go+++ b/cmd/answer/wire_gen.go@@ -135,7 +135,7 @@ func initApplication(debug bool, serverConf *conf.Server, dbConf *data.Database,tagCommonService := tag_common2.NewTagCommonService(tagCommonRepo, tagRelRepo, revisionService, siteInfoCommonService)followRepo := activity_common.NewFollowRepo(dataData, uniqueIDRepo, activityRepo)tagService := tag2.NewTagService(tagRepo, tagCommonService, revisionService, followRepo, siteInfoCommonService)- tagController := controller.NewTagController(tagService, rankService)+ tagController := controller.NewTagController(tagService, tagCommonService, rankService)followFollowRepo := activity.NewFollowRepo(dataData, uniqueIDRepo, activityRepo)followService := follow.NewFollowService(followFollowRepo, followRepo, tagCommonRepo)followController := controller.NewFollowController(followService)diff --git a/internal/controller/tag_controller.go b/internal/controller/tag_controller.goindex 33791cb1..673a746c 100644--- a/internal/controller/tag_controller.go+++ b/internal/controller/tag_controller.go@@ -20,8 +20,12 @@ type TagController struct {}// NewTagController new controller-func NewTagController(tagService *tag.TagService, rankService *rank.RankService) *TagController {- return &TagController{tagService: tagService, rankService: rankService}+func NewTagController(+ tagService *tag.TagService,+ tagCommonService *tag_common.TagCommonService,+ rankService *rank.RankService,+) *TagController {+ return &TagController{tagService: tagService, tagCommonService: tagCommonService, rankService: rankService}}// SearchTagLike get tag listdiff --git a/internal/service/tag_common/tag_common.go b/internal/service/tag_common/tag_common.goindex dda1c923..ec67720a 100644--- a/internal/service/tag_common/tag_common.go+++ b/internal/service/tag_common/tag_common.go@@ -271,6 +271,9 @@ func (ts *TagCommonService) TagFormat(ctx context.Context, tags []*entity.Tag) (}func (ts *TagCommonService) tagsFormatRecommendAndReserved(ctx context.Context, tagList []*entity.Tag) {+ if len(tagList) == 0 {+ return+ }tagConfig, err := ts.siteInfoService.GetSiteWrite(ctx)if err != nil {log.Error(err)@@ -284,6 +287,9 @@ func (ts *TagCommonService) tagsFormatRecommendAndReserved(ctx context.Context,}func (ts *TagCommonService) tagFormatRecommendAndReserved(ctx context.Context, tag *entity.Tag) {+ if tag == nil {+ return+ }tagConfig, err := ts.siteInfoService.GetSiteWrite(ctx)if err != nil {log.Error(err)