From aaa2c0065539baeae415da1ef5e014ecf340ec79 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Tue, 21 Feb 2023 16:30:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E8=B0=83=E6=95=B4=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _const/enum/gift_e/enum.go | 59 ++++++++++++++++++++++++++++++++++++++ cv/user_cv/bag.go | 25 ++++++++++------ route/user_r/bag.go | 24 ++++++++++------ 3 files changed, 90 insertions(+), 18 deletions(-) create mode 100644 _const/enum/gift_e/enum.go diff --git a/_const/enum/gift_e/enum.go b/_const/enum/gift_e/enum.go new file mode 100644 index 0000000..b294199 --- /dev/null +++ b/_const/enum/gift_e/enum.go @@ -0,0 +1,59 @@ +package gift_e + +import "git.hilo.cn/hilo-common/resource/mysql" + +type GiftOperateSceneType mysql.Type + +const ( + //匹配声网中场景 + MatchVedioSceneType GiftOperateSceneType = 1 + // 私聊 + PriveChatSceneType GiftOperateSceneType = 2 + //1对1视频 + VideoSceneType GiftOperateSceneType = 3 + //群组 + GroupSceneType GiftOperateSceneType = 4 +) + +type ResGiftAvatarType = mysql.Type + +const ( + SendGiftCpGiftAvatarType ResGiftAvatarType = 1 //周CP + MonthlyWealthGiftAvatarType ResGiftAvatarType = 2 //月冠财富榜 + MonthlyCharmGiftAvatarType ResGiftAvatarType = 3 //月冠魅力榜 + MonthlyPayGiftAvatarType ResGiftAvatarType = 4 //月冠充值榜 + WeekStarGiftAvatarType ResGiftAvatarType = 5 //周星榜 + CountryStarGiftAvatarType ResGiftAvatarType = 6 // 国家之星 +) + +type GiftPrivateRecordType = mysql.Type + +const ( + PrivateRecord GiftPrivateRecordType = 1 + VideoTradeUnion GiftPrivateRecordType = 2 +) + +type GiftColumnType = uint16 + +const ( + GiftColumnGift GiftColumnType = 1 // 礼物 + GiftColumnRomance GiftColumnType = 2 // 浪漫 + GiftColumnCountry GiftColumnType = 3 // 国家 + GiftColumnCustom GiftColumnType = 4 // 定制 +) + +type GiftTagType = uint16 + +const ( + GiftTagMedal GiftTagType = 1 // 勋章礼物 + GiftTagWeeklyStar GiftTagType = 2 // 周星礼物 +) + +type GiftEntryType = uint16 + +const ( + GiftEntryWeeklyStar GiftEntryType = 1 // 周星活动入口 + GiftEntryWeeklyCp GiftEntryType = 2 // 周CP活动入口 + GiftEntryMedal GiftEntryType = 3 // 勋章激活动入口 + GiftEntryCountryStar GiftEntryType = 4 // 国家之星活动入口 +) diff --git a/cv/user_cv/bag.go b/cv/user_cv/bag.go index 3ce3974..db2e68f 100644 --- a/cv/user_cv/bag.go +++ b/cv/user_cv/bag.go @@ -2,16 +2,23 @@ package user_cv import ( "git.hilo.cn/hilo-common/resource/mysql" + "hilo-user/_const/enum/gift_e" ) 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"` // 资源名称 - DiamondNum mysql.Num `json:"diamondNum"` // 钻石数量 - IconUrl string `json:"iconUrl"` // icon url - SvgaUrl string `json:"svgaUrl"` // svga url - Count mysql.Num `json:"count"` // 拥有数量 - RemainDays int `json:"remainDays"` // 有效天数 + BagId mysql.ID `json:"bagId"` // 背包id + ResType mysql.Type `json:"resType"` // 道具类型 1:礼物道具 + ResId mysql.ID `json:"resId"` // 道具资源id + GiftId mysql.ID `json:"giftId"` // 礼物id,同礼物面板结构体 + Name string `json:"name"` // 资源名称 + DiamondNum mysql.Num `json:"diamondNum"` // 钻石数量 + IconUrl string `json:"iconUrl"` // icon url + SvgaUrl string `json:"svgaUrl"` // svga url + Count mysql.Num `json:"count"` // 拥有数量 + RemainDays int `json:"remainDays"` // 有效天数 + Tags []gift_e.GiftTagType `json:"tags"` // 角标 + ShowEntry bool `json:"showEntry"` // 是否显示快捷入口 + GroupBroadcast bool `json:"group_broadcast"` // 是否群组群发 + SenderAvatar string `json:"senderAvatar"` // key:sender_avatar + ReceiverAvatar string `json:"receiverAvatar"` // key:receiver_avatar } diff --git a/route/user_r/bag.go b/route/user_r/bag.go index 660cbe9..c2947bd 100644 --- a/route/user_r/bag.go +++ b/route/user_r/bag.go @@ -31,6 +31,8 @@ func UserBag(c *gin.Context) (*mycontext.MyContext, error) { if err != nil { return myCtx, err } + //weeklyStarGifts, _ := activity_m.GetWeeklyStartGift(model) + //medalGifts, _ := res_m.FindMedalPublicObtainAll(model.Db) var results []user_cv.UserBag switch res_e.ResUserBag(resType) { case res_e.ResUserBagGift: @@ -45,15 +47,19 @@ 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, - 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), + Tags: nil, // todo + ShowEntry: false, // todo + GroupBroadcast: gift.GroupBroadcast, }) } } -- 2.22.0