暂存
This commit is contained in:
@@ -193,7 +193,7 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
},
|
||||
}),
|
||||
Args: graphql.FieldConfigArgument{
|
||||
"preference": &graphql.ArgumentConfig{Type: graphql.Int, Description: "按照指定用户ID的偏好推荐图像"},
|
||||
"preference": &graphql.ArgumentConfig{Type: graphql.String, Description: "使用浏览记录获取的偏好推荐图像"},
|
||||
"similar": &graphql.ArgumentConfig{Type: graphql.Int, Description: "获取与指定ID图像相似的图像"},
|
||||
"id": &graphql.ArgumentConfig{Type: graphql.Int, Description: "获取指定ID的图像"},
|
||||
"width": &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中指定宽度的"},
|
||||
@@ -224,8 +224,8 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
After string
|
||||
Before string
|
||||
Text string
|
||||
Preference string
|
||||
Similar int
|
||||
Preference int
|
||||
}
|
||||
mapstructure.Decode(p.Args, &args)
|
||||
|
||||
@@ -259,7 +259,10 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
var id_list []string
|
||||
|
||||
// 特殊处理 preference 参数
|
||||
if args.Preference != 0 {
|
||||
if args.Preference != "" {
|
||||
// 去除空格并拆分以逗号分割的ID
|
||||
id_list = strings.Split(strings.ReplaceAll(args.Preference, " ", ""), ",")
|
||||
// 使用这一组 id 推荐
|
||||
fmt.Println("preference:", args.Preference)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user