修正筛选
This commit is contained in:
@@ -428,17 +428,15 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
|||||||
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
|
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
|
||||||
// 定义参数结构体
|
// 定义参数结构体
|
||||||
var args struct {
|
var args struct {
|
||||||
First int
|
First int
|
||||||
Last int
|
Last int
|
||||||
After int
|
After int
|
||||||
Before int
|
Before int
|
||||||
Text string
|
Text string
|
||||||
Interest int
|
Interest int
|
||||||
Similar int
|
Similar int
|
||||||
Follower int
|
Sort string
|
||||||
Orientation string
|
Order string
|
||||||
Sort string
|
|
||||||
Order string
|
|
||||||
}
|
}
|
||||||
mapstructure.Decode(p.Args, &args)
|
mapstructure.Decode(p.Args, &args)
|
||||||
|
|
||||||
@@ -452,7 +450,8 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
|||||||
// 筛选条件
|
// 筛选条件
|
||||||
for _, format := range argFormat {
|
for _, format := range argFormat {
|
||||||
if p.Args[format] != nil {
|
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]})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user