Commit 834af6c5 authored by hujiebin's avatar hujiebin

fix:不用上架的礼物都可以在背包

parent ed788325
......@@ -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 {
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment