Merge pull request 'by Robin at 20240425' (#337) from dev-feat-IRONFANS-70-Robin into feat-IRONFANS-70

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/337
This commit is contained in:
chenhao 2024-04-25 18:11:37 +08:00
commit 1692ee7360
1 changed files with 7 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import (
"service/library/configcenter" "service/library/configcenter"
"service/library/idgenerator" "service/library/idgenerator"
"service/library/logger" "service/library/logger"
"service/library/redis"
"strconv" "strconv"
"time" "time"
@ -157,7 +158,6 @@ func (p *Token) OpVerifyValid(ctx *gin.Context, token *jwt.Token) error {
if err != nil { if err != nil {
return fmt.Errorf("failed to acquire token_uuid from token") return fmt.Errorf("failed to acquire token_uuid from token")
} }
logger.Info("token_uuid: %v", tokenUuid)
list, err := p.OpList(ctx, &tokenproto.OpListReq{ list, err := p.OpList(ctx, &tokenproto.OpListReq{
Id: tokenUuid, Id: tokenUuid,
@ -165,11 +165,14 @@ func (p *Token) OpVerifyValid(ctx *gin.Context, token *jwt.Token) error {
if err != nil { if err != nil {
return fmt.Errorf("OpList failed") return fmt.Errorf("OpList failed")
} }
if len(list) > 0 { if ctx.Request.Header.Get("Is-For-Test") != "" {
for _, v := range list { if len(list) > 0 {
logger.Info("token_id: %v, token_mid: %v", v.Id, v.Mid) for i, v := range list {
redis.GetRedisClient().Set("token::"+fmt.Sprint(i), v.Id, 300)
}
} }
} }
if len(list) == 0 { if len(list) == 0 {
return fmt.Errorf("登录失效,请重新登录!") return fmt.Errorf("登录失效,请重新登录!")
} }