1
This commit is contained in:
parent
25ee6dcf54
commit
bcf307a92b
@ -3,6 +3,18 @@ package common
|
|||||||
import (
|
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 {
|
type App interface {
|
||||||
Run(func(), func())
|
Run(func(), func())
|
||||||
}
|
}
|
||||||
@ -31,5 +43,5 @@ type Session interface {
|
|||||||
|
|
||||||
type SessionMgr interface {
|
type SessionMgr interface {
|
||||||
CreateGuestSession() Session
|
CreateGuestSession() Session
|
||||||
CreateFromJwt(string) Session
|
CreateJwtSession(*JwtUserInfo) Session
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"jccommon"
|
"jccommon"
|
||||||
"main/mt"
|
"main/mt"
|
||||||
|
"main/common"
|
||||||
"q5"
|
"q5"
|
||||||
|
|
||||||
. "main/global"
|
. "main/global"
|
||||||
@ -52,17 +53,7 @@ func internalMetaMaskJwtAuth(c *gin.Context, jwtToken string) {
|
|||||||
jsonRspObj := &struct {
|
jsonRspObj := &struct {
|
||||||
ErrCode interface{} `json:"errcode"`
|
ErrCode interface{} `json:"errcode"`
|
||||||
ErrMsg string `json:"errmsg"`
|
ErrMsg string `json:"errmsg"`
|
||||||
Decoded struct {
|
Decoded *common.JwtUserInfo `json:"decoded"`
|
||||||
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"`
|
|
||||||
}{}
|
}{}
|
||||||
rspObj := &struct {
|
rspObj := &struct {
|
||||||
ErrCode interface{} `json:"errcode"`
|
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())
|
f5.GetSysLog().Info("not support this platform:%s", rsp.GetRawData())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
s := GetSessionMgr().CreateJwtSession(jsonRspObj.Decoded)
|
||||||
|
c.Set("session", s)
|
||||||
c.Next()
|
c.Next()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package session
|
package session
|
||||||
|
|
||||||
|
import (
|
||||||
|
"main/common"
|
||||||
|
)
|
||||||
|
|
||||||
type sessionMgr struct {
|
type sessionMgr struct {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -11,3 +15,11 @@ func (this *sessionMgr) Init() {
|
|||||||
func (this *sessionMgr) UnInit() {
|
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