This commit is contained in:
aozhiwei 2024-11-04 18:03:50 +08:00
parent fae1cbd940
commit 06d2c7e9e7
3 changed files with 13 additions and 4 deletions

View File

@ -1,7 +1,8 @@
package user package user
import ( import (
//"main/common" "main/constant"
"main/common"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -9,5 +10,8 @@ type UserApi struct {
} }
func (this *UserApi) Login(c *gin.Context) { func (this *UserApi) Login(c *gin.Context) {
//s := c.MustGet("session").(common.Session) s := c.MustGet(constant.SESSION_KEY).(common.Session)
if s == nil {
}
} }

View File

@ -16,3 +16,7 @@ const (
const ( const (
PLAT_ID_TG = 5 PLAT_ID_TG = 5
) )
const (
SESSION_KEY = "session"
)

View File

@ -6,6 +6,7 @@ import (
"jccommon" "jccommon"
"main/mt" "main/mt"
"main/common" "main/common"
"main/constant"
"q5" "q5"
. "main/global" . "main/global"
@ -32,7 +33,7 @@ func internalJwtAuth(c *gin.Context, maybe bool) {
} else { } else {
if maybe { if maybe {
s := GetSessionMgr().CreateGuestSession() s := GetSessionMgr().CreateGuestSession()
c.Set("session", s) c.Set(constant.SESSION_KEY, s)
c.Next() c.Next()
return return
} }
@ -94,7 +95,7 @@ func internalMetaMaskJwtAuth(c *gin.Context, jwtToken string) {
return return
} }
s := GetSessionMgr().CreateJwtSession(jsonRspObj.Decoded) s := GetSessionMgr().CreateJwtSession(jsonRspObj.Decoded)
c.Set("session", s) c.Set(constant.SESSION_KEY, s)
c.Next() c.Next()
}) })
} }