diff options
Diffstat (limited to 'web/controller')
| -rw-r--r-- | web/controller/api.go | 2 | ||||
| -rw-r--r-- | web/controller/inbound.go | 12 |
2 files changed, 5 insertions, 9 deletions
diff --git a/web/controller/api.go b/web/controller/api.go index b8da9243..54298daf 100644 --- a/web/controller/api.go +++ b/web/controller/api.go @@ -27,7 +27,7 @@ func (a *APIController) initRouter(g *gin.RouterGroup) { g.POST("/clearClientIps/:email", a.clearClientIps) g.POST("/addClient/", a.addInboundClient) g.POST("/:id/delClient/:clientId", a.delInboundClient) - g.POST("/updateClient/:index", a.updateInboundClient) + g.POST("/updateClient/:clientId", a.updateInboundClient) g.POST("/:id/resetClientTraffic/:email", a.resetClientTraffic) g.POST("/resetAllTraffics", a.resetAllTraffics) g.POST("/resetAllClientTraffics/:id", a.resetAllClientTraffics) diff --git a/web/controller/inbound.go b/web/controller/inbound.go index ec37dcc7..7b86e2b4 100644 --- a/web/controller/inbound.go +++ b/web/controller/inbound.go @@ -35,7 +35,7 @@ func (a *InboundController) initRouter(g *gin.RouterGroup) { g.POST("/clearClientIps/:email", a.clearClientIps) g.POST("/addClient", a.addInboundClient) g.POST("/:id/delClient/:clientId", a.delInboundClient) - g.POST("/updateClient/:index", a.updateInboundClient) + g.POST("/updateClient/:clientId", a.updateInboundClient) g.POST("/:id/resetClientTraffic/:email", a.resetClientTraffic) g.POST("/resetAllTraffics", a.resetAllTraffics) g.POST("/resetAllClientTraffics/:id", a.resetAllClientTraffics) @@ -199,20 +199,16 @@ func (a *InboundController) delInboundClient(c *gin.Context) { } func (a *InboundController) updateInboundClient(c *gin.Context) { - index, err := strconv.Atoi(c.Param("index")) - if err != nil { - jsonMsg(c, I18n(c, "pages.inbounds.revise"), err) - return - } + clientId := c.Param("clientId") inbound := &model.Inbound{} - err = c.ShouldBind(inbound) + err := c.ShouldBind(inbound) if err != nil { jsonMsg(c, I18n(c, "pages.inbounds.revise"), err) return } - err = a.inboundService.UpdateInboundClient(inbound, index) + err = a.inboundService.UpdateInboundClient(inbound, clientId) if err != nil { jsonMsg(c, "something worng!", err) return |
