1
This commit is contained in:
parent
25ee6dcf54
commit
bcf307a92b
@ -3,6 +3,18 @@ package common
|
||||
import (
|
||||
)
|
||||
|
||||
type JwtUserInfo struct {
|
||||
Id string `json:"id"`
|
||||
Uid string `json:"uid"`
|
||||
Gid string `json:"gid"`
|
||||
OpenId string `json:"openid"`
|
||||
Version int32 `json:"version"`
|
||||
Plat int32 `json:"plat"`
|
||||
PlatVip int32 `json:"platVip"`
|
||||
Invited string `json:"invited"`
|
||||
NickName string `json:"nickname"`
|
||||
}
|
||||
|
||||
type App interface {
|
||||
Run(func(), func())
|
||||
}
|
||||
@ -31,5 +43,5 @@ type Session interface {
|
||||
|
||||
type SessionMgr interface {
|
||||
CreateGuestSession() Session
|
||||
CreateFromJwt(string) Session
|
||||
CreateJwtSession(*JwtUserInfo) Session
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"jccommon"
|
||||
"main/mt"
|
||||
"main/common"
|
||||
"q5"
|
||||
|
||||
. "main/global"
|
||||
@ -52,17 +53,7 @@ func internalMetaMaskJwtAuth(c *gin.Context, jwtToken string) {
|
||||
jsonRspObj := &struct {
|
||||
ErrCode interface{} `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
Decoded struct {
|
||||
Id string `json:"id"`
|
||||
Uid string `json:"uid"`
|
||||
Gid string `json:"gid"`
|
||||
OpenId string `json:"openid"`
|
||||
Version int32 `json:"version"`
|
||||
Plat int32 `json:"plat"`
|
||||
PlatVip int32 `json:"platVip"`
|
||||
Invited string `json:"invited"`
|
||||
NickName string `json:"nickname"`
|
||||
} `json:"decoded"`
|
||||
Decoded *common.JwtUserInfo `json:"decoded"`
|
||||
}{}
|
||||
rspObj := &struct {
|
||||
ErrCode interface{} `json:"errcode"`
|
||||
@ -102,6 +93,8 @@ func internalMetaMaskJwtAuth(c *gin.Context, jwtToken string) {
|
||||
f5.GetSysLog().Info("not support this platform:%s", rsp.GetRawData())
|
||||
return
|
||||
}
|
||||
s := GetSessionMgr().CreateJwtSession(jsonRspObj.Decoded)
|
||||
c.Set("session", s)
|
||||
c.Next()
|
||||
})
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
package session
|
||||
|
||||
import (
|
||||
"main/common"
|
||||
)
|
||||
|
||||
type sessionMgr struct {
|
||||
|
||||
}
|
||||
@ -11,3 +15,11 @@ func (this *sessionMgr) Init() {
|
||||
func (this *sessionMgr) UnInit() {
|
||||
|
||||
}
|
||||
|
||||
func (this *sessionMgr) CreateGuestSession() common.Session {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *sessionMgr) CreateJwtSession(userInfo *common.JwtUserInfo) common.Session {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user