uniugm/admin/apps/game/service/service_cdkey.go

35 lines
925 B
Go
Raw Normal View History

2025-05-07 18:25:31 +08:00
package service
import (
"admin/apps/game/domain/entity"
"admin/internal/errcode"
2025-05-16 15:17:10 +08:00
"admin/internal/model/dto"
2025-05-07 18:25:31 +08:00
)
2025-05-08 15:48:34 +08:00
func (svc *Service) GetCDKeyAllKeys(projectId int, id int) (*entity.CDKey, []string, error) {
et, find, err := svc.cdkeySvc.Get(projectId, id)
2025-05-07 18:25:31 +08:00
if err != nil {
return nil, nil, err
}
if !find {
return nil, nil, errcode.New(errcode.ParamsInvalid, "not found cdkey:%v", id)
}
return et, et.GenerateKeys(), nil
}
2025-05-08 15:48:34 +08:00
func (svc *Service) CDKeyAddCount(projectId int, id int, deltaCount int) (int, error) {
return svc.cdkeySvc.AddCount(projectId, id, deltaCount)
}
func (svc *Service) CDKeyUse(params *dto.CDKeyUseReq) (*entity.CDKey, error) {
batchInfo, err := svc.cdkeySvc.CDKeyUse(params)
if err != nil {
return nil, err
}
return batchInfo, nil
}
func (svc *Service) CDKeyUsedHistoryList(projectId, id int) ([]*dto.CDKeyUsedInfo, error) {
return svc.cdkeySvc.GetUsedHistoryList(projectId, id)
2025-05-07 18:25:31 +08:00
}