新增合作与反馈入口配置
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user