service/api/proto/account/proto/account_vo_api.go

77 lines
3.4 KiB
Go

package proto
import "service/dbstruct"
// 查询自己返回的实体
type ApiListVO struct {
Mid *int64 `json:"mid" bson:"_id"` // 用户表Id
Name *string `json:"name" bson:"name"` // 用户名
UserId *int64 `json:"user_id" bson:"user_id"` // 业务Id
Avatar *dbstruct.MediaComponent `json:"avatar" bson:"avatar"` // 头像
Level *int64 `json:"level" bson:"level"` // 等级
Role *int64 `json:"role" bson:"role"` // 角色
CurrentExp *int64 `json:"current_exp" bson:"current_exp"` // 当前经验
CurrentLevelExp *int64 `json:"current_level_exp" bson:"current_level_exp"` // 当前等级总经验
IsDndModeEnabled *int64 `json:"is_dnd_mode_enabled" bson:"is_dnd_mode_enabled"` // 是否开启勿扰模式
GoldNum *int64 `json:"gold_num" bson:"gold_num"` // 金币数量
DiamondNum *int64 `json:"diamond_num" bson:"diamond_num"` // 钻石数量
WithdrawDiamondNum *int64 `json:"withdraw_diamond_num" bson:"withdraw_diamond_num"` // 提现钻石数量
IsAMember *int64 `json:"is_a_member" bson:"is_a_member"` // 是否会员
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
}
// 查询别人返回的实体
type ApiListOthersVO struct {
Mid *int64 `json:"mid" bson:"_id"` // 用户表Id
Name *string `json:"name" bson:"name"` // 用户名
UserId *int64 `json:"user_id" bson:"user_id"` // 业务Id
Avatar *dbstruct.MediaComponent `json:"avatar" bson:"avatar"` // 头像
Level *int64 `json:"level" bson:"level"` // 等级
Role *int64 `json:"role" bson:"role"` // 角色
}
func (vo *ApiListVO) CopyAccount(account *dbstruct.Account) *ApiListVO {
if account == nil {
return vo
}
vo.Mid = account.Mid
vo.Name = account.Name
vo.UserId = account.UserId
vo.Avatar = account.Avatar
vo.Level = account.Level
vo.Role = account.Role
vo.CurrentExp = account.CurrentExp
vo.CurrentLevelExp = account.CurrentLevelExp
vo.IsDndModeEnabled = account.IsDndModeEnabled
vo.GoldNum = account.GoldNum
vo.DiamondNum = account.DiamondNum
vo.IsAMember = account.IsAMember
vo.Ct = account.Ct
vo.Ut = account.Ut
return vo
}
func (vo *ApiListVO) CopyWallet(wallet *dbstruct.Wallet) *ApiListVO {
if wallet == nil {
return vo
}
vo.GoldNum = wallet.Coins
vo.DiamondNum = wallet.Diamonds
vo.WithdrawDiamondNum = wallet.WithdrawDiamonds
return vo
}
func (vo *ApiListOthersVO) CopyAccount(account *dbstruct.Account) *ApiListOthersVO {
if account == nil {
return vo
}
vo.Mid = account.Mid
vo.Name = account.Name
vo.UserId = account.UserId
vo.Avatar = account.Avatar
vo.Level = account.Level
vo.Role = account.Role
return vo
}