diff --git a/common/cool/service.go b/common/cool/service.go index 858b6cb2..c8b30603 100644 --- a/common/cool/service.go +++ b/common/cool/service.go @@ -240,7 +240,9 @@ func (s *Service) ServiceList(ctx context.Context, req *ListReq) (data interface for _, field := range s.ListQueryOp.DataFieldEQ { if val := r.Get(field); val.String() != "" { // 关键:拼接 data->>'字段名' = ? - m.Where("data->>? = ?", field, val) + // 错误写法:m.Where("data->>::TEXT? = ?", field, val) + // 正确写法: + m.Where("(data->>?)::TEXT = ?", field, val) } } } @@ -356,7 +358,9 @@ func (s *Service) ServicePage(ctx context.Context, req *PageReq) (data interface for _, field := range s.PageQueryOp.DataFieldEQ { if val := r.Get(field); val.String() != "" { // 关键:拼接 data->>'字段名' = ? - m.Where("data->>? = ?", field, val) + // 错误写法:m.Where("data->>::TEXT? = ?", field, val) + // 正确写法: + m.Where("(data->>?)::TEXT = ?", field, val) } } } diff --git a/modules/player/service/pet.go b/modules/player/service/pet.go index 86c1642f..4def1706 100644 --- a/modules/player/service/pet.go +++ b/modules/player/service/pet.go @@ -320,7 +320,8 @@ func NewPetService(userid uint32) *PetService { }, }, PageQueryOp: &cool.QueryOp{ - FieldEQ: []string{"player_id", "free"}, + FieldEQ: []string{"player_id", "free"}, + DataFieldEQ: []string{"ID"}, Where: func(ctx context.Context) [][]interface{} { // var ( // admin = cool.GetAdmin(ctx)