redis, updatediff

This commit is contained in:
suyl
2021-07-07 15:24:12 +08:00
parent 2beca9fbcb
commit acb48212a1
7 changed files with 346 additions and 19 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"git.rosy.net.cn/jx-print/globals"
"git.rosy.net.cn/jx-print/model"
putils "git.rosy.net.cn/jx-print/utils"
"github.com/dchest/captcha"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
@@ -42,9 +43,10 @@ func callFunc(c *gin.Context, worker func() (retVal interface{}, errCode string,
} else {
token = cookie.Value
}
if token != "token" {
err = fmt.Errorf("token过期,请重新登录!")
if user := putils.GetKet(token); user == nil {
err = fmt.Errorf("token过期或无效,请重新登录!")
callBack.Desc = err.Error()
callBack.Code = model.ErrCodeToken
c.JSON(http.StatusOK, callBack)
return false
}