1
This commit is contained in:
@@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user