新增合作与反馈入口配置

This commit is contained in:
yml2213
2026-08-15 16:37:30 +08:00
parent 134d6fa05e
commit d9f552577a
14 changed files with 332 additions and 36 deletions
@@ -32,15 +32,20 @@ func (s *Service) HomeConfig(ctx context.Context) (*HomeConfigDTO, error) {
if err != nil {
return nil, err
}
cooperationFeedback, err := s.cooperationFeedback(ctx)
if err != nil {
return nil, err
}
publishOptions, err := s.publishOptions(ctx)
if err != nil {
return nil, err
}
return &HomeConfigDTO{
Announcements: announcements,
Banners: banners,
PublishOptions: publishOptions,
AWRecycle: awRecycle,
Announcements: announcements,
Banners: banners,
PublishOptions: publishOptions,
AWRecycle: awRecycle,
CooperationFeedback: cooperationFeedback,
}, nil
}
@@ -79,3 +84,15 @@ func (s *Service) awRecycle(ctx context.Context) (AWRecycleConfig, error) {
}
return normalizeAWRecycle(item), nil
}
func (s *Service) cooperationFeedback(ctx context.Context) (CooperationFeedbackConfig, error) {
value, err := s.repo.FindValue(ctx, cooperationFeedbackConfigKey)
if err != nil {
return defaultCooperationFeedback(), err
}
item := defaultCooperationFeedback()
if err := json.Unmarshal([]byte(value), &item); err != nil {
item = defaultCooperationFeedback()
}
return normalizeCooperationFeedback(item), nil
}