updated misc ipbl functions
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2022-02-25 13:39:19 +01:00
parent 52e767b941
commit 2bf11fdb75
2 changed files with 1 additions and 7 deletions

View File

@ -80,7 +80,7 @@ func InsertIPBulk(cfg *config.Config, ips *[]IP) (numinserts int64, numupdates i
for _, ip := range searchips { for _, ip := range searchips {
toupdateips = append(toupdateips, ip.IP) toupdateips = append(toupdateips, ip.IP)
} }
cfg.Db.In("ip", toupdateips).Cols("updated").Update(&IP{}) numupdates, _ = cfg.Db.In("ip", toupdateips).Cols("updated").Update(&IP{})
var toinsertip, _ = differ(*ips, searchips) var toinsertip, _ = differ(*ips, searchips)
numinserts, err = cfg.Db.Insert(toinsertip) numinserts, err = cfg.Db.Insert(toinsertip)

View File

@ -52,12 +52,6 @@ func RegisterRoutes(e *echo.Echo, ctx *context.Context, cfg *config.Config) {
ret, err := models.GetIPs(ctx, cfg, limit) ret, err := models.GetIPs(ctx, cfg, limit)
return Result(c, err, ret) return Result(c, err, ret)
}) })
// retro-compat
e.GET("/ips/lastday", func(c echo.Context) (err error) {
interval := "1 day"
ret, err := models.GetIPsLast(ctx, cfg, interval)
return Result(c, err, ret)
})
e.GET("/ips/last", func(c echo.Context) (err error) { e.GET("/ips/last", func(c echo.Context) (err error) {
interval := "10 minutes" interval := "10 minutes"
ret, err := models.GetIPsLast(ctx, cfg, interval) ret, err := models.GetIPsLast(ctx, cfg, interval)