数据库中筛选:按游戏标签
This commit is contained in:
		@@ -390,9 +390,14 @@ var ImageItems = &graphql.Field{
 | 
				
			|||||||
		// 数据库中筛选:按游戏标签
 | 
							// 数据库中筛选:按游戏标签
 | 
				
			||||||
		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), " ", ""), ",")
 | 
				
			||||||
 | 
								var conditions []string
 | 
				
			||||||
			for _, tag := range tags {
 | 
								for _, tag := range tags {
 | 
				
			||||||
				query = query.Where(goqu.L("MATCH(web_images.tags) AGAINST (? IN NATURAL LANGUAGE MODE)", tag))
 | 
									conditions = append(conditions, fmt.Sprintf("FIND_IN_SET('%s', web_article.tags)", tag))
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								query = query.Join(goqu.T("web_article"), goqu.On(
 | 
				
			||||||
 | 
									goqu.I("web_images.article_id").Eq(goqu.I("web_article.id")),
 | 
				
			||||||
 | 
									goqu.L(strings.Join(conditions, " AND ")),
 | 
				
			||||||
 | 
								))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// 数据库中筛选:按游戏分类
 | 
							// 数据库中筛选:按游戏分类
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user