修正 Follower 筛选

This commit is contained in:
2024-11-08 17:19:17 +08:00
parent a196ada6e3
commit 5bbb3a8797

View File

@@ -485,7 +485,7 @@ func NewSchema(config Config) (graphql.Schema, error) {
SELECT JSON_ARRAYAGG(web_images.id) AS json_result
FROM web_fans
INNER JOIN web_images ON web_images.user_id = web_fans.blogger_id
WHERE web_fans.follower_id = ? AND web_images.article_id IS NOT NULL
WHERE web_fans.follower_id = ? AND web_images.article_category_top_id = 22
`, args.Follower).Scan(&item).Error; err != nil {
fmt.Println("获取关注列表失败", err)
return nil, err
@@ -567,7 +567,7 @@ func NewSchema(config Config) (graphql.Schema, error) {
// 存在外部筛选条件
if len(id_list) > 0 && len(list) > 0 {
query = query.Where("id IN ?", list).Where("article_category_top_id = 22")
query = query.Where("id IN ?", list)
}
for index, item := range LoadItem(p.Info.FieldASTs[0].SelectionSet.Selections) {
@@ -575,8 +575,8 @@ func NewSchema(config Config) (graphql.Schema, error) {
query = query.Preload(item)
}
// 输出
if err := query.Find(&images).Error; err != nil {
// 输出(游戏截图分类ID为22)
if err := query.Where("article_category_top_id = 22").Find(&images).Error; err != nil {
fmt.Println("获取图像列表失败", err)
return nil, err
}