From d5859d8126852b800e286c6756be619bff491857 Mon Sep 17 00:00:00 2001 From: satori Date: Sat, 9 Nov 2024 12:17:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=B3=E8=BF=87=E7=A9=BA=E5=80=BC=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/graphql.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/api/graphql.go b/api/graphql.go index cf28cda..3332c03 100644 --- a/api/graphql.go +++ b/api/graphql.go @@ -499,12 +499,11 @@ func NewSchema(config Config) (graphql.Schema, error) { item = append(item, num) } - query = query.Where("web_images.id IN (?)", item) + if len(item) == 0 { + return map[string]interface{}{"list": []Image{}, "total": 0}, nil + } - //id_list = append(id_list, item) - //if len(id_list) == 0 { - // return map[string]interface{}{"list": []Image{}, "total": 0}, nil - //} + query = query.Where("web_images.id IN (?)", item) } // 筛选:相似图像