add downlaod client setting

This commit is contained in:
Simon Ding
2024-07-09 16:19:19 +08:00
parent a3ac9aeec7
commit 86060cb7be
6 changed files with 216 additions and 15 deletions

View File

@@ -136,3 +136,13 @@ func (s *Server) GetAllDonloadClients(c *gin.Context) (interface{}, error) {
}
return res, nil
}
func (s *Server) DeleteDownloadCLient(c *gin.Context) (interface{}, error) {
var ids = c.Param("id")
id, err := strconv.Atoi(ids)
if err != nil {
return nil, fmt.Errorf("id is not correct: %v", ids)
}
s.db.DeleteDownloadCLient(id)
return "success", nil
}

View File

@@ -74,6 +74,7 @@ func (s *Server) Serve() error {
{
downloader.GET("/", HttpHandler(s.GetAllDonloadClients))
downloader.POST("/add", HttpHandler(s.AddDownloadClient))
downloader.DELETE("/del/:id", HttpHandler(s.DeleteDownloadCLient))
}
s.language = s.db.GetLanguage()