Files
ArmedPolice/app/service/session.go
2021-11-24 09:08:07 +08:00

33 lines
738 B
Go

package service
import (
"ArmedPolice/utils"
"encoding/json"
)
type Session struct {
Token string `json:"token"` // token
UID uint64 `json:"uid"` // 用户ID
TenantID uint64 `json:"tenant_id"` // 租户ID
Name string `json:"name"` // 名称
Avatar string `json:"avatar"` // 头像
Mobile string `json:"mobile"` // 联系方式
IsAdmin bool `json:"is_admin"` // 超管
}
func (this *Session) MarshalBinary() ([]byte, error) {
return json.Marshal(this)
}
func (this *Session) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, this)
}
func (this *Session) UIDToString() string {
return utils.UintToString(this.UID)
}
func NewSession() *Session {
return &Session{}
}