第 5 阶段:纠纷、通知与后台-1

This commit is contained in:
yml
2026-05-22 16:34:32 +08:00
parent 9ebdfab078
commit 99f9df7bcd
32 changed files with 1711 additions and 8 deletions
@@ -0,0 +1,33 @@
package systemconfig
import "errors"
var (
ErrDependencyUnavailable = errors.New("dependency unavailable")
ErrInvalidConfig = errors.New("invalid config")
)
type Service struct {
repo *Repository
}
func NewService(repo *Repository) *Service {
return &Service{repo: repo}
}
func (s *Service) List() ([]ConfigDTO, error) {
if s.repo == nil {
return nil, ErrDependencyUnavailable
}
return s.repo.List()
}
func (s *Service) Update(actorID uint64, key string, req UpdateRequest, meta AuditMeta) (*ConfigDTO, error) {
if s.repo == nil {
return nil, ErrDependencyUnavailable
}
if key == "" || req.Value == "" {
return nil, ErrInvalidConfig
}
return s.repo.Update(actorID, key, req, meta)
}