Commit aaa2c006 authored by hujiebin's avatar hujiebin

feat:调整结构体

parent 2c0cbe8d
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 // 国家之星活动入口
)
...@@ -2,16 +2,23 @@ package user_cv ...@@ -2,16 +2,23 @@ package user_cv
import ( import (
"git.hilo.cn/hilo-common/resource/mysql" "git.hilo.cn/hilo-common/resource/mysql"
"hilo-user/_const/enum/gift_e"
) )
type UserBag struct { type UserBag struct {
BagId mysql.ID `json:"bagId"` // 背包id BagId mysql.ID `json:"bagId"` // 背包id
ResType mysql.Type `json:"resType"` // 道具类型 1:礼物道具 ResType mysql.Type `json:"resType"` // 道具类型 1:礼物道具
ResId mysql.ID `json:"resId"` // 道具资源id ResId mysql.ID `json:"resId"` // 道具资源id
Name string `json:"name"` // 资源名称 GiftId mysql.ID `json:"giftId"` // 礼物id,同礼物面板结构体
DiamondNum mysql.Num `json:"diamondNum"` // 钻石数量 Name string `json:"name"` // 资源名称
IconUrl string `json:"iconUrl"` // icon url DiamondNum mysql.Num `json:"diamondNum"` // 钻石数量
SvgaUrl string `json:"svgaUrl"` // svga url IconUrl string `json:"iconUrl"` // icon url
Count mysql.Num `json:"count"` // 拥有数量 SvgaUrl string `json:"svgaUrl"` // svga url
RemainDays int `json:"remainDays"` // 有效天数 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
} }
...@@ -31,6 +31,8 @@ func UserBag(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -31,6 +31,8 @@ func UserBag(c *gin.Context) (*mycontext.MyContext, error) {
if err != nil { if err != nil {
return myCtx, err return myCtx, err
} }
//weeklyStarGifts, _ := activity_m.GetWeeklyStartGift(model)
//medalGifts, _ := res_m.FindMedalPublicObtainAll(model.Db)
var results []user_cv.UserBag var results []user_cv.UserBag
switch res_e.ResUserBag(resType) { switch res_e.ResUserBag(resType) {
case res_e.ResUserBagGift: case res_e.ResUserBagGift:
...@@ -45,15 +47,19 @@ func UserBag(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -45,15 +47,19 @@ func UserBag(c *gin.Context) (*mycontext.MyContext, error) {
for _, bagGift := range userBagGifts { for _, bagGift := range userBagGifts {
if gift, ok := allValidGifts[bagGift.ResId]; ok { if gift, ok := allValidGifts[bagGift.ResId]; ok {
results = append(results, user_cv.UserBag{ results = append(results, user_cv.UserBag{
BagId: bagGift.ID, BagId: bagGift.ID,
ResType: res_e.ResUserBagGift, ResType: res_e.ResUserBagGift,
ResId: gift.ID, ResId: gift.ID,
Name: gift.Name, GiftId: gift.ID,
DiamondNum: gift.DiamondNum, Name: gift.Name,
IconUrl: gift.IconUrl, DiamondNum: gift.DiamondNum,
SvgaUrl: gift.SvagUrl, IconUrl: gift.IconUrl,
Count: bagGift.Count, SvgaUrl: gift.SvagUrl,
RemainDays: int(bagGift.EndTime.Sub(time.Now()).Hours() / 24), Count: bagGift.Count,
RemainDays: int(bagGift.EndTime.Sub(time.Now()).Hours() / 24),
Tags: nil, // todo
ShowEntry: false, // todo
GroupBroadcast: gift.GroupBroadcast,
}) })
} }
} }
......
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