修正筛选

This commit is contained in:
2024-11-10 10:38:24 +08:00
parent 661a124dd5
commit 6a6e9a5283

View File

@@ -428,17 +428,15 @@ func NewSchema(config Config) (graphql.Schema, error) {
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
// 定义参数结构体
var args struct {
First int
Last int
After int
Before int
Text string
Interest int
Similar int
Follower int
Orientation string
Sort string
Order string
First int
Last int
After int
Before int
Text string
Interest int
Similar int
Sort string
Order string
}
mapstructure.Decode(p.Args, &args)
@@ -452,7 +450,8 @@ func NewSchema(config Config) (graphql.Schema, error) {
// 筛选条件
for _, format := range argFormat {
if p.Args[format] != nil {
query.Where(goqu.Ex{fmt.Sprintf("web_images.%s = ?", format): p.Args[format]})
fmt.Println(format, p.Args[format])
query = query.Where(goqu.Ex{fmt.Sprintf("web_images.%s", format): p.Args[format]})
}
}