package domain import ( "admin/apps/game/domain/entity" "admin/apps/game/domain/repo" "gorm.io/gorm" ) type CDKeyService struct { repo repo.ICDKeyRepo } func NewCDKeyService(db *gorm.DB) *CDKeyService { return &CDKeyService{repo: repo.NewCDKeyRepo(db)} } func (svc *CDKeyService) AddCount(id int, delta int) (int, error) { et, err := svc.repo.AddCount(id, delta) if err != nil { return 0, err } return et.GetCount(), nil } func (svc *CDKeyService) Get(id int) (*entity.CDKey, bool, error) { return svc.repo.GetByID(id) }