mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-08 18:23:45 +08:00
fix: fixed bug for jwt token expire caculation
This commit is contained in:
@@ -2,8 +2,10 @@ package handler
|
||||
|
||||
import (
|
||||
"chatplus/core"
|
||||
"chatplus/core/types"
|
||||
logger2 "chatplus/logger"
|
||||
"chatplus/utils"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -40,3 +42,10 @@ func (h *BaseHandler) GetBool(c *gin.Context, key string) bool {
|
||||
func (h *BaseHandler) PostBool(c *gin.Context, key string) bool {
|
||||
return utils.BoolValue(c.PostForm(key))
|
||||
}
|
||||
func (h *BaseHandler) GetUserKey(c *gin.Context) string {
|
||||
userId, ok := c.Get(types.LoginUserID)
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("users/%v", userId)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user