From a9a19fa77985e45c51e805339054c92f3e9913ac Mon Sep 17 00:00:00 2001 From: kanade Date: Wed, 30 Nov 2022 13:43:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/api/manage/brand/query.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/api/manage/brand/query.go b/internal/api/manage/brand/query.go index 089ff0a..39fc2e7 100755 --- a/internal/api/manage/brand/query.go +++ b/internal/api/manage/brand/query.go @@ -40,10 +40,14 @@ func QueryBrandList(c *gin.Context) { brandIds := []uint{} for _, item := range list { - brandIds = append(brandIds, item.InfoId) + if item.InfoId > 0 { + brandIds = append(brandIds, item.InfoId) + } } var ppimg []vend.GysEnterpriseImg - dbc.DB.Where("brand_id in (?) and type = 2", brandIds).Find(&ppimg) + if len(brandIds) > 0 { + dbc.DB.Where("brand_id in (?) and type = 2", brandIds).Find(&ppimg) + } ppimgMap := map[uint][]string{} for _, img := range ppimg { ppimgMap[img.BrandID] = append(ppimgMap[img.BrandID], img.Url)