feat:优化项目结构
This commit is contained in:
42
app/session/enterprise.go
Normal file
42
app/session/enterprise.go
Normal file
@ -0,0 +1,42 @@
|
||||
package session
|
||||
|
||||
import (
|
||||
"SciencesServer/utils"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// Enterprise 企业用户
|
||||
type Enterprise struct {
|
||||
Token string `json:"token"` // token
|
||||
UID uint64 `json:"uid"` // 唯一标识ID
|
||||
TenantID uint64 `json:"tenant_id"` // 租户ID
|
||||
ManageUID uint64 `json:"manage_uid"` // 管理平台用户唯一ID
|
||||
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.GetToken()
|
||||
}
|
||||
|
||||
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{}
|
||||
}
|
36
app/session/manage.go
Normal file
36
app/session/manage.go
Normal file
@ -0,0 +1,36 @@
|
||||
package session
|
||||
|
||||
import (
|
||||
"SciencesServer/utils"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type Manage 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 *Manage) SetToken(token string) {
|
||||
this.Token = token
|
||||
}
|
||||
|
||||
func (this *Manage) GetToken() string {
|
||||
return this.GetToken()
|
||||
}
|
||||
|
||||
func (this *Manage) MarshalBinary() ([]byte, error) {
|
||||
return json.Marshal(this)
|
||||
}
|
||||
|
||||
func (this *Manage) UnmarshalBinary(data []byte) error {
|
||||
return utils.FromJSONBytes(data, this)
|
||||
}
|
||||
|
||||
func NewManage() *Manage {
|
||||
return &Manage{}
|
||||
}
|
Reference in New Issue
Block a user