Files
bl/modules/player/service/cdk_log.go

43 lines
646 B
Go
Raw Normal View History

package service
import (
"blazing/cool"
"blazing/modules/player/model"
"github.com/gogf/gf/v2/frame/g"
)
type CdkService struct {
BaseService
}
func (s *CdkService) CanGet(id uint32) bool {
m1, _ := s.TestModel(s.Model).Where("code_id", id).Exist()
return !m1
}
func (s *CdkService) Log(id uint32) {
m := s.TestModel(s.Model)
data := g.Map{
"player_id": s.userid,
"code_id": id,
"is_vip": cool.Config.ServerInfo.IsVip,
}
m.Data(data).Insert()
}
func NewCdkService(id uint32) *CdkService {
return &CdkService{
BaseService: BaseService{userid: id,
Service: &cool.Service{Model: model.NewCdkLog()},
},
}
}