分类筛选
This commit is contained in:
		@@ -508,6 +508,8 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
				
			|||||||
				"era":           &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏年份筛选图像"},
 | 
									"era":           &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏年份筛选图像"},
 | 
				
			||||||
				"category_id":   &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏类型筛选图像(支持多选)"},
 | 
									"category_id":   &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏类型筛选图像(支持多选)"},
 | 
				
			||||||
				"tags":          &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏标签筛选图像(支持多选)"},
 | 
									"tags":          &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏标签筛选图像(支持多选)"},
 | 
				
			||||||
 | 
									"images_desc":   &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏归类筛选图像(支持多选)"},
 | 
				
			||||||
 | 
									"article_tags":  &graphql.ArgumentConfig{Type: graphql.String, Description: "按文章标签筛选图像(支持多选)"},
 | 
				
			||||||
				"color":         &graphql.ArgumentConfig{Type: graphql.String, Description: "按主色调筛选图像, 使用十六进制颜色代码(#FF1414)"},
 | 
									"color":         &graphql.ArgumentConfig{Type: graphql.String, Description: "按主色调筛选图像, 使用十六进制颜色代码(#FF1414)"},
 | 
				
			||||||
				"explorer_id":   &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中指定收藏夹的"},
 | 
									"explorer_id":   &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中指定收藏夹的"},
 | 
				
			||||||
				"collect_id":    &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中指定收藏夹的"},
 | 
									"collect_id":    &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中指定收藏夹的"},
 | 
				
			||||||
@@ -666,7 +668,26 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
				
			|||||||
				if p.Args["tags"] != nil {
 | 
									if p.Args["tags"] != nil {
 | 
				
			||||||
					tags := strings.Split(strings.ReplaceAll(p.Args["tags"].(string), " ", ""), ",")
 | 
										tags := strings.Split(strings.ReplaceAll(p.Args["tags"].(string), " ", ""), ",")
 | 
				
			||||||
					for _, tag := range tags {
 | 
										for _, tag := range tags {
 | 
				
			||||||
						query = query.Where(goqu.L("MATCH(images_desc) AGAINST (? IN NATURAL LANGUAGE MODE)", tag))
 | 
											query = query.Where(goqu.L("MATCH(web_images.images_tags) AGAINST (? IN NATURAL LANGUAGE MODE)", tag))
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									// 数据库中筛选:按游戏分类
 | 
				
			||||||
 | 
									if p.Args["images_desc"] != nil {
 | 
				
			||||||
 | 
										tags := strings.Split(strings.ReplaceAll(p.Args["images_desc"].(string), " ", ""), ",")
 | 
				
			||||||
 | 
										for _, tag := range tags {
 | 
				
			||||||
 | 
											query = query.Where(goqu.L("MATCH(web_images.images_desc) AGAINST (? IN NATURAL LANGUAGE MODE)", tag))
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									// 数据库中筛选:按文章标签
 | 
				
			||||||
 | 
									if p.Args["article_tags"] != nil {
 | 
				
			||||||
 | 
										tags := strings.Split(strings.ReplaceAll(p.Args["article_tags"].(string), " ", ""), ", ")
 | 
				
			||||||
 | 
										for _, tag := range tags {
 | 
				
			||||||
 | 
											query = query.Join(goqu.T("web_article"), goqu.On(
 | 
				
			||||||
 | 
												goqu.I("web_images.article_id").Eq(goqu.I("web_article.id")),
 | 
				
			||||||
 | 
												goqu.L("MATCH(web_article.tags) AGAINST (? IN NATURAL LANGUAGE MODE)", tag),
 | 
				
			||||||
 | 
											))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user