Skip to content

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: upload add siteinfo service

LinkinStar498b7f489334
diff --git a/cmd/answer/wire_gen.go b/cmd/answer/wire_gen.go
index 302a67de..2e002347 100644
--- a/cmd/answer/wire_gen.go
+++ b/cmd/answer/wire_gen.go
@@ -108,7 +108,7 @@ func initApplication(debug bool, serverConf *conf.Server, dbConf *data.Database,
userService := service.NewUserService(userRepo, userActiveActivityRepo, emailService, authService, serviceConf, siteInfoCommonService)
captchaRepo := captcha.NewCaptchaRepo(dataData)
captchaService := action.NewCaptchaService(captchaRepo)
- uploaderService := uploader.NewUploaderService(serviceConf)
+ uploaderService := uploader.NewUploaderService(serviceConf, siteInfoCommonService)
userController := controller.NewUserController(authService, userService, captchaService, emailService, uploaderService)
commentRepo := comment.NewCommentRepo(dataData, uniqueIDRepo)
commentCommonRepo := comment.NewCommentCommonRepo(dataData, uniqueIDRepo)
diff --git a/internal/service/uploader/upload.go b/internal/service/uploader/upload.go
index f4a8e61d..1d6d2491 100644
--- a/internal/service/uploader/upload.go
+++ b/internal/service/uploader/upload.go
@@ -33,7 +33,8 @@ type UploaderService struct {
}
// NewUploaderService new upload service
-func NewUploaderService(serviceConfig *service_config.ServiceConfig) *UploaderService {
+func NewUploaderService(serviceConfig *service_config.ServiceConfig,
+ siteInfoService *siteinfo_common.SiteInfoCommonService) *UploaderService {
err := dir.CreateDirIfNotExist(filepath.Join(serviceConfig.UploadPath, avatarSubPath))
if err != nil {
panic(err)
@@ -43,7 +44,8 @@ func NewUploaderService(serviceConfig *service_config.ServiceConfig) *UploaderSe
panic(err)
}
return &UploaderService{
- serviceConfig: serviceConfig,
+ serviceConfig: serviceConfig,
+ siteInfoService: siteInfoService,
}
}