feat:增加用户资产和会员状态
This commit is contained in:
15
app/api/enterprise/controller/user/assets.go
Normal file
15
app/api/enterprise/controller/user/assets.go
Normal file
@ -0,0 +1,15 @@
|
||||
package user
|
||||
|
||||
import "SciencesServer/app/session"
|
||||
|
||||
type Assets struct {
|
||||
*session.Enterprise
|
||||
}
|
||||
|
||||
type AssetsHandle func(session *session.Enterprise) *Assets
|
||||
|
||||
func NewAssets() AssetsHandle {
|
||||
return func(session *session.Enterprise) *Assets {
|
||||
return &Assets{Enterprise: session}
|
||||
}
|
||||
}
|
@ -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 绑定手机号码
|
||||
|
Reference in New Issue
Block a user