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("系统计数器设置异常")