2021-09-30 12:09:45 +08:00
|
|
|
package user
|
|
|
|
|
|
|
|
import (
|
|
|
|
"SciencesServer/app/service"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Instance struct{ *service.SessionEnterprise }
|
|
|
|
|
|
|
|
type InstanceHandle func(enterprise *service.SessionEnterprise) *Instance
|
|
|
|
|
2021-10-08 09:39:40 +08:00
|
|
|
type (
|
|
|
|
// InstanceInfoReturn 基本信息返回
|
|
|
|
InstanceInfoReturn struct {
|
2021-10-08 17:33:19 +08:00
|
|
|
Name string `json:"name"` // 名称
|
|
|
|
Avatar string `json:"avatar"` // 头像
|
|
|
|
Identity int `json:"identity"` // 具体身份
|
|
|
|
SelectIdentity int `json:"select_identity"` // 最后一次选中的身份信息
|
2021-10-08 09:39:40 +08:00
|
|
|
}
|
|
|
|
)
|
2021-09-30 12:09:45 +08:00
|
|
|
|
2021-10-08 09:39:40 +08:00
|
|
|
// Info 基本信息
|
|
|
|
func (c *Instance) Info() *InstanceInfoReturn {
|
2021-10-08 17:33:19 +08:00
|
|
|
return &InstanceInfoReturn{Name: c.Name, Avatar: c.Avatar, Identity: c.Identity, SelectIdentity: c.SelectIdentity}
|
2021-09-30 12:09:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewInstance() InstanceHandle {
|
|
|
|
return func(enterprise *service.SessionEnterprise) *Instance {
|
|
|
|
return &Instance{enterprise}
|
|
|
|
}
|
|
|
|
}
|