From 8b19f53f8bb48cbfa66258c5852e7f1afd00e64f Mon Sep 17 00:00:00 2001 From: kelvin Date: Wed, 10 May 2023 19:38:54 +0800 Subject: [PATCH] debug add --- main.go | 1 + service.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/main.go b/main.go index f246354..190074d 100644 --- a/main.go +++ b/main.go @@ -466,6 +466,7 @@ func checkKeyMid() gin.HandlerFunc { c.AbortWithStatusJSON(msg, gin.H{"code": err.Error()}) } } + log.Printf("auth check end") // 执行函数 c.Next() } diff --git a/service.go b/service.go index d0253be..30add9d 100644 --- a/service.go +++ b/service.go @@ -13,6 +13,7 @@ func checkKeyAndTimeCount(key string) (int, error) { var timeOut = 60 * time.Second var timeCount = 30 userInfoStr, err := Redis.Get(context.Background(), "user:"+key).Result() + log.Printf("用户信息 %s", userInfoStr) if err != nil { //用户不存在 return 401, errors.New("40003") @@ -24,6 +25,7 @@ func checkKeyAndTimeCount(key string) (int, error) { return 401, errors.New("40004") } count, err := Redis.Incr(context.Background(), "user:count:"+key).Result() + log.Printf("用户请求次数 %d", count) if err != nil { log.Printf("系统计数器设置异常 %s", err.Error()) return 500, errors.New("系统计数器设置异常")