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

42 lines
646 B
Go
Raw Normal View History

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待测试
m := s.dbm_fix(s.Model).Where("season", model.Curpvp)
m.Scan(&ret)
if ret == nil {
ret = &model.PVP{
PlayerID: uint32(userid),
Season: uint32(model.Curpvp),
RankInfo: model.PVPRankInfo{
Score: 800,
},
}
s.dbm_fix(s.Model).Data(ret).Insert()
}
return
}