diff --git a/cv/user_cv/bag.go b/cv/user_cv/bag.go index 7af3718ed7896f578103620ea894eafbdc2fc6ad..3ce3974a2207add28f83ae30c47d228ca3bdac9e 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 f1c16c11ae5584ededf987dcc50b1a86465572c5..01e76b020db5651b4076d47ca6150be907e25111 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 72be1ac7190ff44540258d0c339b84d9fda729f1..660cbe910046f4e19ccef6b9dacbb5bca9d644fa 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,