mirror of https://gitee.com/answerdev/answer.git
Merge branch 'ai/0.4.0/tag' into test
# Conflicts: # cmd/answer/wire_gen.go # internal/service/search_service.go # internal/service/tag_common/tag_common.go
This commit is contained in:
commit
89a79a02fa
|
@ -59,7 +59,6 @@ import (
|
|||
"github.com/answerdev/answer/internal/service/report_backyard"
|
||||
"github.com/answerdev/answer/internal/service/report_handle_backyard"
|
||||
"github.com/answerdev/answer/internal/service/revision_common"
|
||||
"github.com/answerdev/answer/internal/service/search_parser"
|
||||
"github.com/answerdev/answer/internal/service/service_config"
|
||||
"github.com/answerdev/answer/internal/service/siteinfo"
|
||||
"github.com/answerdev/answer/internal/service/siteinfo_common"
|
||||
|
@ -136,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)
|
||||
|
@ -157,9 +156,8 @@ func initApplication(debug bool, serverConf *conf.Server, dbConf *data.Database,
|
|||
answerService := service.NewAnswerService(answerRepo, questionRepo, questionCommon, userCommon, collectionCommon, userRepo, revisionService, answerActivityService, answerCommon, voteRepo)
|
||||
dashboardService := dashboard.NewDashboardService(questionRepo, answerRepo, commentCommonRepo, voteRepo, userRepo, reportRepo, configRepo, siteInfoCommonService, serviceConf, dataData)
|
||||
answerController := controller.NewAnswerController(answerService, rankService, dashboardService)
|
||||
searchParser := search_parser.NewSearchParser(tagCommonService, userCommon)
|
||||
searchRepo := search_common.NewSearchRepo(dataData, uniqueIDRepo, userCommon)
|
||||
searchService := service.NewSearchService(searchParser, searchRepo)
|
||||
searchService := service.NewSearchService(searchRepo, tagCommonService, userCommon, followRepo)
|
||||
searchController := controller.NewSearchController(searchService)
|
||||
serviceRevisionService := service.NewRevisionService(revisionRepo, userCommon, questionCommon, answerService)
|
||||
revisionController := controller.NewRevisionController(serviceRevisionService)
|
||||
|
@ -183,8 +181,7 @@ func initApplication(debug bool, serverConf *conf.Server, dbConf *data.Database,
|
|||
notificationService := notification2.NewNotificationService(dataData, notificationRepo, notificationCommon)
|
||||
notificationController := controller.NewNotificationController(notificationService)
|
||||
dashboardController := controller.NewDashboardController(dashboardService)
|
||||
uploadController := controller.NewUploadController(uploaderService)
|
||||
answerAPIRouter := router.NewAnswerAPIRouter(langController, userController, commentController, reportController, voteController, tagController, followController, collectionController, questionController, answerController, searchController, revisionController, rankController, controller_backyardReportController, userBackyardController, reasonController, themeController, siteInfoController, siteinfoController, notificationController, dashboardController, uploadController)
|
||||
answerAPIRouter := router.NewAnswerAPIRouter(langController, userController, commentController, reportController, voteController, tagController, followController, collectionController, questionController, answerController, searchController, revisionController, rankController, controller_backyardReportController, userBackyardController, reasonController, themeController, siteInfoController, siteinfoController, notificationController, dashboardController)
|
||||
swaggerRouter := router.NewSwaggerRouter(swaggerConf)
|
||||
uiRouter := router.NewUIRouter()
|
||||
authUserMiddleware := middleware.NewAuthUserMiddleware(authService)
|
||||
|
|
|
@ -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 list
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue