From 0e0fba371ed3c5678047e760d13e9b0839ef5747 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Fri, 7 Jul 2023 11:19:21 +0800 Subject: [PATCH] feature/3.10 --- cv/user_cv/bag.go | 1 + domain/model/res_m/gift.go | 1 + route/user_r/bag.go | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/cv/user_cv/bag.go b/cv/user_cv/bag.go index e33a638..4203315 100644 --- a/cv/user_cv/bag.go +++ b/cv/user_cv/bag.go @@ -16,6 +16,7 @@ type UserBag struct { Count mysql.Num `json:"count"` // 拥有数量 RemainDays int `json:"remainDays"` // 有效天数 TextStyleList []*TextStyle `json:"textStyleList"` // 文本样式 + HasGiftText bool `json:"hasGiftText"` // 是否有礼物文字 } type TextStyle struct { diff --git a/domain/model/res_m/gift.go b/domain/model/res_m/gift.go index 79f1776..78bc0f8 100644 --- a/domain/model/res_m/gift.go +++ b/domain/model/res_m/gift.go @@ -22,6 +22,7 @@ type ResGift struct { Together bool Status mysql.UserYesNo GiftType mysql.Type + HasGiftText bool } // 获取所有的礼物 diff --git a/route/user_r/bag.go b/route/user_r/bag.go index 3d83b33..18a38ba 100644 --- a/route/user_r/bag.go +++ b/route/user_r/bag.go @@ -46,16 +46,17 @@ func UserBag(c *gin.Context) (*mycontext.MyContext, error) { for _, bagGift := range userBagGifts { if gift, ok := allGifts[bagGift.ResId]; ok { info := user_cv.UserBag{ - BagId: bagGift.ID, - ResType: res_e.ResUserBagGift, - ResId: gift.ID, - GiftId: gift.ID, - Name: gift.Name, - DiamondNum: gift.DiamondNum, - IconUrl: gift.IconUrl, - SvgaUrl: gift.SvagUrl, - Count: bagGift.Count, - RemainDays: int(bagGift.EndTime.Sub(time.Now()).Hours() / 24), + BagId: bagGift.ID, + ResType: res_e.ResUserBagGift, + ResId: gift.ID, + GiftId: gift.ID, + Name: gift.Name, + DiamondNum: gift.DiamondNum, + IconUrl: gift.IconUrl, + SvgaUrl: gift.SvagUrl, + Count: bagGift.Count, + RemainDays: int(bagGift.EndTime.Sub(time.Now()).Hours() / 24), + HasGiftText: gift.HasGiftText, } if gift.ID == cp_e.CpConfessionGiftId { // 如果是cp告白礼物 info.TextStyleList = make([]*user_cv.TextStyle, 0, 2) -- 2.22.0