From 834af6c5365c3d951920a6269e736ccfd4fac093 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Wed, 15 Mar 2023 18:23:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=B8=8D=E7=94=A8=E4=B8=8A=E6=9E=B6?= =?UTF-8?q?=E7=9A=84=E7=A4=BC=E7=89=A9=E9=83=BD=E5=8F=AF=E4=BB=A5=E5=9C=A8?= =?UTF-8?q?=E8=83=8C=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain/model/res_m/gift.go | 6 +++--- route/user_r/bag.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/domain/model/res_m/gift.go b/domain/model/res_m/gift.go index 5c540d0..79f1776 100644 --- a/domain/model/res_m/gift.go +++ b/domain/model/res_m/gift.go @@ -24,11 +24,11 @@ type ResGift struct { GiftType mysql.Type } -// 获取所有有效的礼物 -func FindValidResGiftsMap(model *domain.Model) (map[mysql.ID]ResGift, error) { +// 获取所有的礼物 +func FindAllResGiftsMap(model *domain.Model) (map[mysql.ID]ResGift, error) { res := make(map[mysql.ID]ResGift, 0) rows := make([]ResGift, 0) - if err := model.DB().Model(ResGift{}).Where("status = ?", mysql.USER).Find(&rows).Error; err != nil { + if err := model.DB().Model(ResGift{}).Find(&rows).Error; err != nil { return nil, err } for i, v := range rows { diff --git a/route/user_r/bag.go b/route/user_r/bag.go index fb3038d..c425f55 100644 --- a/route/user_r/bag.go +++ b/route/user_r/bag.go @@ -38,12 +38,12 @@ func UserBag(c *gin.Context) (*mycontext.MyContext, error) { if err != nil { return myCtx, err } - allValidGifts, err := res_m.FindValidResGiftsMap(model) + allGifts, err := res_m.FindAllResGiftsMap(model) if err != nil { return myCtx, err } for _, bagGift := range userBagGifts { - if gift, ok := allValidGifts[bagGift.ResId]; ok { + if gift, ok := allGifts[bagGift.ResId]; ok { results = append(results, user_cv.UserBag{ BagId: bagGift.ID, ResType: res_e.ResUserBagGift, -- 2.22.0