Files
2021-09-30 12:09:45 +08:00

51 lines
1.4 KiB
Go

package service
import (
"SciencesServer/utils"
"encoding/json"
)
type Session struct {
UID uint64 `json:"uid"` // 唯一标识ID
Token string `json:"token"` // token
Name string `json:"name"` // 名称
Mobile string `json:"mobile"` // 手机号码
IsAdmin bool `json:"is_admin"` // 是否超管
TenantID uint64 `json:"tenant_id"` // 租户ID
TenantKey string `json:"tenant_key"` // 租户标识,用来区别分库管理
}
func (this *Session) MarshalBinary() ([]byte, error) {
return json.Marshal(this)
}
func (this *Session) UnmarshalBinary(data []byte) error {
return utils.FromJSONBytes(data, this)
}
func NewSession() *Session {
return &Session{}
}
// SessionEnterprise 企业用户
type SessionEnterprise struct {
UID uint64 `json:"uid"` // 唯一标识ID
Token string `json:"token"` // token
Name string `json:"name"` // 名称
Mobile string `json:"mobile"` // 手机号码
Identity int `json:"identity"` // 总身份信息
CurrentIdentity int `json:"current_identity"` // 当前身份信息
}
func (this *SessionEnterprise) MarshalBinary() ([]byte, error) {
return json.Marshal(this)
}
func (this *SessionEnterprise) UnmarshalBinary(data []byte) error {
return utils.FromJSONBytes(data, this)
}
func NewSessionEnterprise() *SessionEnterprise {
return &SessionEnterprise{}
}