Files
bl/modules/player/service/pvp.go
昔念 4906197c77 1
2026-04-25 23:05:41 +08:00

43 lines
683 B
Go

package service
import (
"blazing/cool"
"blazing/modules/player/model"
)
type PVPService struct {
BaseService
}
func NewPVPService(id uint32) *PVPService {
return &PVPService{
BaseService: BaseService{userid: id,
Service: &cool.Service{Model: model.NewPVP()},
},
}
}
func (s *PVPService) Get(userid uint32) (ret *model.PVP) {
//todo待测试
currentSeason := model.CurrentPVPSeason()
m := s.dbm_fix(s.Model).Where("season", currentSeason)
m.Scan(&ret)
if ret == nil {
ret = &model.PVP{
PlayerID: uint32(userid),
Season: currentSeason,
RankInfo: model.PVPRankInfo{
Score: 800,
},
}
s.dbm_fix(s.Model).Data(ret).Insert()
}
return
}