This commit is contained in:
昔念
2026-04-25 23:05:41 +08:00
parent 415315c288
commit 4906197c77
18 changed files with 1009 additions and 31 deletions

View File

@@ -325,6 +325,13 @@ type PetService struct {
BaseService
}
func petFreeFilterQuery(ctx context.Context, m *gdb.Model) *gdb.Model {
if !g.RequestFromCtx(ctx).Get("free_all").Bool() {
m = m.WhereNot("free", 0)
}
return m
}
func NewPetService(userid uint32) *PetService {
return &PetService{
BaseService: BaseService{
@@ -336,20 +343,20 @@ func NewPetService(userid uint32) *PetService {
FieldEQ: []string{"player_id", "free"},
Where: func(ctx context.Context) [][]interface{} {
return [][]interface{}{
{"free", 0, false},
{"is_vip", 0, true},
}
},
Extend: petFreeFilterQuery,
},
PageQueryOp: &cool.QueryOp{
FieldEQ: []string{"player_id", "free"},
DataFieldEQ: []string{"ID"},
Where: func(ctx context.Context) [][]interface{} {
return [][]interface{}{
{"free", 0, false},
{"is_vip", 0, true},
}
},
Extend: petFreeFilterQuery,
},
},
},

View File

@@ -23,13 +23,14 @@ func (s *PVPService) Get(userid uint32) (ret *model.PVP) {
//todo待测试
m := s.dbm_fix(s.Model).Where("season", model.Curpvp)
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: uint32(model.Curpvp),
Season: currentSeason,
RankInfo: model.PVPRankInfo{
Score: 800,
},