43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package session
|
|
|
|
import (
|
|
"SciencesServer/utils"
|
|
"encoding/json"
|
|
)
|
|
|
|
// 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"` // 选中身份信息
|
|
}
|
|
|
|
func (this *Enterprise) SetToken(token string) {
|
|
this.Token = token
|
|
}
|
|
|
|
func (this *Enterprise) GetToken() string {
|
|
return this.Token
|
|
}
|
|
|
|
func (this *Enterprise) UIDToString() string {
|
|
return utils.UintToString(this.UID)
|
|
}
|
|
|
|
func (this *Enterprise) MarshalBinary() ([]byte, error) {
|
|
return json.Marshal(this)
|
|
}
|
|
|
|
func (this *Enterprise) UnmarshalBinary(data []byte) error {
|
|
return utils.FromJSONBytes(data, this)
|
|
}
|
|
|
|
func NewEnterprise() *Enterprise {
|
|
return &Enterprise{}
|
|
}
|