fix: fixed bug for jwt token expire caculation

This commit is contained in:
RockYang
2023-09-12 10:49:55 +08:00
parent 9afe4aea4b
commit d825b9ec26
3 changed files with 17 additions and 8 deletions

View File

@@ -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)
}