36 lines
749 B
Go
36 lines
749 B
Go
![]() |
package session
|
||
|
|
||
|
import (
|
||
|
"SciencesServer/utils"
|
||
|
"encoding/json"
|
||
|
)
|
||
|
|
||
|
type Admin struct {
|
||
|
UID uint64 `json:"uid"` // 唯一标识ID
|
||
|
TenantID uint64 `json:"tenant_id"` // 租户ID
|
||
|
Token string `json:"token"` // token
|
||
|
Name string `json:"name"` // 名称
|
||
|
Mobile string `json:"mobile"` // 手机号码
|
||
|
IsAdmin bool `json:"is_admin"` // 是否超管
|
||
|
}
|
||
|
|
||
|
func (this *Admin) SetToken(token string) {
|
||
|
this.Token = token
|
||
|
}
|
||
|
|
||
|
func (this *Admin) GetToken() string {
|
||
|
return this.GetToken()
|
||
|
}
|
||
|
|
||
|
func (this *Admin) MarshalBinary() ([]byte, error) {
|
||
|
return json.Marshal(this)
|
||
|
}
|
||
|
|
||
|
func (this *Admin) UnmarshalBinary(data []byte) error {
|
||
|
return utils.FromJSONBytes(data, this)
|
||
|
}
|
||
|
|
||
|
func NewAdmin() *Admin {
|
||
|
return &Admin{}
|
||
|
}
|