2026-03-04 23:38:21 +08:00
|
|
|
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待测试
|
|
|
|
|
|
2026-03-20 04:58:23 +08:00
|
|
|
m := s.dbm_fix(s.Model).Where("season", model.Curpvp)
|
2026-03-04 23:38:21 +08:00
|
|
|
|
|
|
|
|
m.Scan(&ret)
|
2026-03-17 10:11:10 +08:00
|
|
|
if ret == nil {
|
|
|
|
|
ret = &model.PVP{
|
|
|
|
|
PlayerID: uint32(userid),
|
2026-03-20 04:58:23 +08:00
|
|
|
Season: uint32(model.Curpvp),
|
|
|
|
|
RankInfo: model.PVPRankInfo{
|
|
|
|
|
Score: 800,
|
|
|
|
|
},
|
2026-03-17 10:11:10 +08:00
|
|
|
}
|
2026-03-20 04:58:23 +08:00
|
|
|
s.dbm_fix(s.Model).Data(ret).Insert()
|
2026-03-17 10:11:10 +08:00
|
|
|
}
|
2026-03-20 04:58:23 +08:00
|
|
|
|
2026-03-04 23:38:21 +08:00
|
|
|
return
|
|
|
|
|
}
|