feat:增加用户资产和会员状态
This commit is contained in:
@ -3,18 +3,22 @@ package session
|
||||
import (
|
||||
"SciencesServer/utils"
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Enterprise 企业用户
|
||||
type Enterprise struct {
|
||||
Token string `json:"token"` // token
|
||||
UID uint64 `json:"uid"` // 唯一标识ID
|
||||
IdentityUID uint64 `json:"identity_uid"` // 用户身份唯一ID
|
||||
Avatar string `json:"avatar"` // 头像
|
||||
Name string `json:"name"` // 名称
|
||||
Mobile string `json:"mobile"` // 手机号码
|
||||
Identity int `json:"identity"` // 总身份信息
|
||||
SelectIdentity int `json:"select_identity"` // 选中身份信息
|
||||
Token string `json:"token"` // token
|
||||
UID uint64 `json:"uid"` // 唯一标识ID
|
||||
IdentityUID uint64 `json:"identity_uid"` // 用户身份唯一ID
|
||||
Avatar string `json:"avatar"` // 头像
|
||||
Name string `json:"name"` // 名称
|
||||
Mobile string `json:"mobile"` // 手机号码
|
||||
Vip bool `json:"vip"` // VIP状态
|
||||
VipDeadline time.Time `json:"vip_deadline"` // VIP过期时间
|
||||
Currency float64 `json:"currency"` // 货币-创新币
|
||||
Identity int `json:"identity"` // 总身份信息
|
||||
SelectIdentity int `json:"select_identity"` // 选中身份信息
|
||||
}
|
||||
|
||||
func (this *Enterprise) SetToken(token string) {
|
||||
@ -29,6 +33,10 @@ func (this *Enterprise) UIDToString() string {
|
||||
return utils.UintToString(this.UID)
|
||||
}
|
||||
|
||||
func (this *Enterprise) VipStatus() bool {
|
||||
return this.Vip && this.VipDeadline.After(time.Now())
|
||||
}
|
||||
|
||||
func (this *Enterprise) MarshalBinary() ([]byte, error) {
|
||||
return json.Marshal(this)
|
||||
}
|
||||
|
Reference in New Issue
Block a user