feat:增加用户资产和会员状态

This commit is contained in:
henry
2021-12-10 11:34:19 +08:00
parent 626f30a2bd
commit 2ee564d540
13 changed files with 188 additions and 31 deletions

View File

@ -17,10 +17,13 @@ type InstanceHandle func(session *session.Enterprise) *Instance
type (
// InstanceInfo 基本信息
InstanceInfo struct {
Avatar string `json:"avatar"` // 头像
Name string `json:"name"` // 名称
Identity int `json:"identity"` // 具体身份
SelectIdentity int `json:"select_identity"` // 最后一次选中的身份信息
Avatar string `json:"avatar"` // 头像
Name string `json:"name"` // 名称
Currency float64 `json:"currency"` // 创新币
Vip bool `json:"vip"` // Vip状态
VipDays int `json:"vip_days"` // Vip剩余天数
Identity int `json:"identity"` // 具体身份
SelectIdentity int `json:"select_identity"` // 最后一次选中的身份信息
}
// InstanceDetailInfo 详细信息
InstanceDetailInfo struct {
@ -33,7 +36,16 @@ type (
// Info 基本信息
func (c *Instance) Info() *InstanceInfo {
return &InstanceInfo{Avatar: c.Avatar, Name: c.Name, Identity: c.Identity, SelectIdentity: c.SelectIdentity}
out := &InstanceInfo{Avatar: c.Avatar, Name: c.Name,
Currency: c.Currency,
Vip: c.VipStatus(),
Identity: c.Identity,
SelectIdentity: c.SelectIdentity}
if out.Vip {
out.VipDays = utils.DiffTimeDays(time.Now(), c.VipDeadline)
}
return out
}
// BindMobile 绑定手机号码