This commit is contained in:
henry
2021-11-02 09:43:19 +08:00
parent 570bb3c772
commit 4734344985
78 changed files with 4798 additions and 0 deletions

30
app/service/session.go Normal file
View File

@ -0,0 +1,30 @@
package service
import (
"Edu/utils"
"encoding/json"
)
type Session struct {
ID uint64 `json:"id"` // 用户ID
OpenID string `json:"open_id"`
Token string `json:"token"` // token
Name string `json:"name"` // 名称
SessionKey string `json:"session_key"` // 用户信息
}
func (this *Session) MarshalBinary() ([]byte, error) {
return json.Marshal(this)
}
func (this *Session) UnmarshalBinary(data []byte) error {
return utils.FromJSONBytes(data, this)
}
func (this *Session) IDToString() string {
return utils.UintToString(this.ID)
}
func NewSession() *Session {
return &Session{}
}