From 13ff203f4349125cafa9968384fee401c841cba4 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Mon, 20 Feb 2023 17:19:50 +0800 Subject: [PATCH] fix:bagId --- cv/user_cv/bag.go | 1 + domain/model/bag_m/user_bag.go | 1 + route/user_r/bag.go | 1 + 3 files changed, 3 insertions(+) diff --git a/cv/user_cv/bag.go b/cv/user_cv/bag.go index 7af3718..3ce3974 100644 --- a/cv/user_cv/bag.go +++ b/cv/user_cv/bag.go @@ -5,6 +5,7 @@ import ( ) type UserBag struct { + BagId mysql.ID `json:"bagId"` // 背包id ResType mysql.Type `json:"resType"` // 道具类型 1:礼物道具 ResId mysql.ID `json:"resId"` // 道具资源id Name string `json:"name"` // 资源名称 diff --git a/domain/model/bag_m/user_bag.go b/domain/model/bag_m/user_bag.go index f1c16c1..01e76b0 100644 --- a/domain/model/bag_m/user_bag.go +++ b/domain/model/bag_m/user_bag.go @@ -27,6 +27,7 @@ func GetUserValidUserBag(model *domain.Model, userId mysql.ID, resType res_e.Res if err := model.DB().Model(UserBag{}). Where("end_time > ?", time.Now()). Where("count > 0"). + Where("res_type = ?", resType). Where("user_id = ?", userId).Find(&res).Error; err != nil { return nil, err } diff --git a/route/user_r/bag.go b/route/user_r/bag.go index 72be1ac..660cbe9 100644 --- a/route/user_r/bag.go +++ b/route/user_r/bag.go @@ -45,6 +45,7 @@ func UserBag(c *gin.Context) (*mycontext.MyContext, error) { for _, bagGift := range userBagGifts { if gift, ok := allValidGifts[bagGift.ResId]; ok { results = append(results, user_cv.UserBag{ + BagId: bagGift.ID, ResType: res_e.ResUserBagGift, ResId: gift.ID, Name: gift.Name, -- 2.22.0