Commit e24b3a7b authored by gaoshiyao's avatar gaoshiyao

count 计数

parent 70c5f4f2
...@@ -13,6 +13,13 @@ func GetCount(c *gin.Context) { ...@@ -13,6 +13,13 @@ func GetCount(c *gin.Context) {
c.Error(err) c.Error(err)
} }
ic, err := redis.Get("bgproxy" + config.ProxyConf.MeshId) 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{ c.JSON(200, gin.H{
"Key": fmt.Sprintf("bgproxy" + config.ProxyConf.MeshId), "Key": fmt.Sprintf("bgproxy" + config.ProxyConf.MeshId),
"Count": ic, "Count": ic,
......
...@@ -77,7 +77,7 @@ func count() error { ...@@ -77,7 +77,7 @@ func count() error {
if err != nil { if err != nil {
return err return err
} }
ic, err := redis.Incr("bgproxy-" + config.ProxyConf.MeshId) ic, err := redis.Incr("bgproxy" + config.ProxyConf.MeshId)
_, err = ic.Result() _, err = ic.Result()
return err return err
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment