From e24b3a7bc210b2b282f1cb7203f7c1f54a04e3cb Mon Sep 17 00:00:00 2001 From: gaoshiyao Date: Thu, 7 Nov 2019 12:30:38 +0800 Subject: [PATCH] =?UTF-8?q?count=20=E8=AE=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/handler/counthandler.go | 7 +++++++ src/handler/proxyhandler.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/handler/counthandler.go b/src/handler/counthandler.go index b51d1d8..19a0904 100644 --- a/src/handler/counthandler.go +++ b/src/handler/counthandler.go @@ -13,6 +13,13 @@ func GetCount(c *gin.Context) { c.Error(err) } ic, err := redis.Get("bgproxy" + config.ProxyConf.MeshId) + if err != nil { + c.JSON(500, gin.H{ + "success": 0, + "errMsg": err, + }) + return + } c.JSON(200, gin.H{ "Key": fmt.Sprintf("bgproxy" + config.ProxyConf.MeshId), "Count": ic, diff --git a/src/handler/proxyhandler.go b/src/handler/proxyhandler.go index f5ed5a6..2681afa 100644 --- a/src/handler/proxyhandler.go +++ b/src/handler/proxyhandler.go @@ -77,7 +77,7 @@ func count() error { if err != nil { return err } - ic, err := redis.Incr("bgproxy-" + config.ProxyConf.MeshId) + ic, err := redis.Incr("bgproxy" + config.ProxyConf.MeshId) _, err = ic.Result() return err } -- 2.26.0