From e1da43053d23c995bcd6e7267cb20042398cd64f Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Sun, 9 Apr 2023 23:13:18 +0330 Subject: alireza update pack Co-Authored-By: Alireza Ahmadi --- web/controller/inbound.go | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'web/controller/inbound.go') diff --git a/web/controller/inbound.go b/web/controller/inbound.go index b567af8c..f7ea35eb 100644 --- a/web/controller/inbound.go +++ b/web/controller/inbound.go @@ -37,6 +37,8 @@ func (a *InboundController) initRouter(g *gin.RouterGroup) { g.POST("/delClient/:email", a.delInboundClient) g.POST("/updateClient/:index", a.updateInboundClient) g.POST("/:id/resetClientTraffic/:email", a.resetClientTraffic) + g.POST("/resetAllTraffics", a.resetAllTraffics) + g.POST("/resetAllClientTraffics/:id", a.resetAllClientTraffics) } @@ -131,7 +133,7 @@ func (a *InboundController) updateInbound(c *gin.Context) { func (a *InboundController) getClientIps(c *gin.Context) { email := c.Param("email") - ips , err := a.inboundService.GetInboundClientIps(email) + ips, err := a.inboundService.GetInboundClientIps(email) if err != nil { jsonObj(c, "No IP Record", nil) return @@ -230,3 +232,27 @@ func (a *InboundController) resetClientTraffic(c *gin.Context) { a.xrayService.SetToNeedRestart() } } + +func (a *InboundController) resetAllTraffics(c *gin.Context) { + err := a.inboundService.ResetAllTraffics() + if err != nil { + jsonMsg(c, "something worng!", err) + return + } + jsonMsg(c, "All traffics reseted", nil) +} + +func (a *InboundController) resetAllClientTraffics(c *gin.Context) { + id, err := strconv.Atoi(c.Param("id")) + if err != nil { + jsonMsg(c, I18n(c, "pages.inbounds.revise"), err) + return + } + + err = a.inboundService.ResetAllClientTraffics(id) + if err != nil { + jsonMsg(c, "something worng!", err) + return + } + jsonMsg(c, "All traffics of client reseted", nil) +} -- cgit v1.2.3