debug add
continuous-integration/drone/push Build is passing Details

main
kelvin 3 years ago
parent 381030242e
commit 8b19f53f8b

@ -466,6 +466,7 @@ func checkKeyMid() gin.HandlerFunc {
c.AbortWithStatusJSON(msg, gin.H{"code": err.Error()}) c.AbortWithStatusJSON(msg, gin.H{"code": err.Error()})
} }
} }
log.Printf("auth check end")
// 执行函数 // 执行函数
c.Next() c.Next()
} }

@ -13,6 +13,7 @@ func checkKeyAndTimeCount(key string) (int, error) {
var timeOut = 60 * time.Second var timeOut = 60 * time.Second
var timeCount = 30 var timeCount = 30
userInfoStr, err := Redis.Get(context.Background(), "user:"+key).Result() userInfoStr, err := Redis.Get(context.Background(), "user:"+key).Result()
log.Printf("用户信息 %s", userInfoStr)
if err != nil { if err != nil {
//用户不存在 //用户不存在
return 401, errors.New("40003") return 401, errors.New("40003")
@ -24,6 +25,7 @@ func checkKeyAndTimeCount(key string) (int, error) {
return 401, errors.New("40004") return 401, errors.New("40004")
} }
count, err := Redis.Incr(context.Background(), "user:count:"+key).Result() count, err := Redis.Incr(context.Background(), "user:count:"+key).Result()
log.Printf("用户请求次数 %d", count)
if err != nil { if err != nil {
log.Printf("系统计数器设置异常 %s", err.Error()) log.Printf("系统计数器设置异常 %s", err.Error())
return 500, errors.New("系统计数器设置异常") return 500, errors.New("系统计数器设置异常")

Loading…
Cancel
Save