diff --git a/common/cool/service.go b/common/cool/service.go index f9a744ca9..d134c5239 100644 --- a/common/cool/service.go +++ b/common/cool/service.go @@ -208,7 +208,9 @@ func (s *Service) ServiceList(ctx context.Context, req *ListReq) (data interface for _, field := range s.ListQueryOp.KeyWordField { // g.DumpWithType(field) // builder.WhereLike(field, "%"+r.Get("keyWord").String()+"%") - builder = builder.WhereOrLike(field, "%"+r.Get("keyWord").String()+"%") + + builder = builder.WhereOrf(field+"::text LIKE ?", "%"+r.Get("keyWord").String()+"%") + //builder = builder.WhereOrLike(field, "%"+r.Get("keyWord").String()+"%") } m.Where(builder) } diff --git a/modules/config/service/shop.go b/modules/config/service/shop.go index 311b789e3..c07e1c377 100644 --- a/modules/config/service/shop.go +++ b/modules/config/service/shop.go @@ -3,6 +3,9 @@ package service import ( "blazing/cool" "blazing/modules/config/model" + "context" + + "github.com/gogf/gf/v2/frame/g" ) type ShopService struct { @@ -13,6 +16,15 @@ func NewShopService() *ShopService { return &ShopService{ &cool.Service{ Model: model.NewShopConfig(), + ListQueryOp: &cool.QueryOp{ + Where: func(ctx context.Context) []g.Array { + return [][]interface{}{ + + {"is_enable", 1, true}, + } + }, + Select: "product_id,product_name,seerdou_price,jindou_price,remark", + }, PageQueryOp: &cool.QueryOp{ KeyWordField: []string{"desc", "product_name"},