22 lines
585 B
Go
22 lines
585 B
Go
package platformsetting
|
|
|
|
import (
|
|
"context"
|
|
biz "kra/internal/biz/platformsetting"
|
|
"kra/internal/service/dto"
|
|
)
|
|
|
|
type Service struct{ uc *biz.Usecase }
|
|
|
|
func NewService(uc *biz.Usecase) *Service { return &Service{uc: uc} }
|
|
func (s *Service) Get(ctx context.Context) (*dto.PlatformSetting, error) {
|
|
v, e := s.uc.Get(ctx)
|
|
if e != nil {
|
|
return nil, e
|
|
}
|
|
return &dto.PlatformSetting{DiamondRateCents: v.DiamondRateCents}, nil
|
|
}
|
|
func (s *Service) Save(ctx context.Context, v *dto.PlatformSetting) error {
|
|
return s.uc.Save(ctx, &biz.Setting{DiamondRateCents: v.DiamondRateCents})
|
|
}
|