mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-21 08:15:48 +00:00
Add getClientTrafficsById (#1347)
* Add getClientTrafficsById Ability for API to get traffics by uuid * bugfix GetClientTrafficByID * bugfix GetClientTrafficByID * Update GetClientTrafficByID function by Alireza0 Recomendation * update Replace Logger Warning with Debug for GetClientTrafficByID * Fix: return empty array instead of error in case of gorm.ErrRecordNotFound --------- Co-authored-by: Ali Gilani <gilani1364@gmail.com>
This commit is contained in:
committed by
GitHub
parent
f6535dd83e
commit
f5ce84ae68
@@ -33,6 +33,7 @@ func (a *APIController) initRouter(g *gin.RouterGroup) {
|
||||
{"GET", "/", a.inboundController.getInbounds},
|
||||
{"GET", "/get/:id", a.inboundController.getInbound},
|
||||
{"GET", "/getClientTraffics/:email", a.inboundController.getClientTraffics},
|
||||
{"GET", "/getClientTrafficsById/:id", a.inboundController.getClientTrafficsById},
|
||||
{"POST", "/add", a.inboundController.addInbound},
|
||||
{"POST", "/del/:id", a.inboundController.delInbound},
|
||||
{"POST", "/update/:id", a.inboundController.updateInbound},
|
||||
|
||||
@@ -75,6 +75,15 @@ func (a *InboundController) getClientTraffics(c *gin.Context) {
|
||||
jsonObj(c, clientTraffics, nil)
|
||||
}
|
||||
|
||||
func (a *InboundController) getClientTrafficsById(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
clientTraffics, err := a.inboundService.GetClientTrafficByID(id)
|
||||
if err != nil {
|
||||
jsonMsg(c, "Error getting traffics", err)
|
||||
return
|
||||
}
|
||||
jsonObj(c, clientTraffics, nil)
|
||||
}
|
||||
func (a *InboundController) addInbound(c *gin.Context) {
|
||||
inbound := &model.Inbound{}
|
||||
err := c.ShouldBind(inbound)
|
||||
|
||||
Reference in New Issue
Block a user