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
import (
//"main/common"
"main/constant"
"main/common"
"github.com/gin-gonic/gin"
)
@ -9,5 +10,8 @@ type UserApi struct {
}
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 (
PLAT_ID_TG = 5
)
const (
SESSION_KEY = "session"
)

View File

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