mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-11-04 16:40:21 +00:00
refactor: improve performance
This commit is contained in:
1 parent
5158375448
commit
0764dac3b3
4 files changed
+62
-2
No files matched your search
@@ -8,6 +8,7 @@ import (
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
|
||||
"github.com/nezhahq/nezha/model"
|
||||
"github.com/nezhahq/nezha/pkg/utils"
|
||||
"github.com/nezhahq/nezha/service/singleton"
|
||||
)
|
||||
|
||||
@@ -208,7 +209,7 @@ func batchBlockOnlineUser(c *gin.Context) (any, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := singleton.BlockByIPs(list); err != nil {
|
||||
if err := singleton.BlockByIPs(utils.Unique(list)); err != nil {
|
||||
return nil, newGormError("%v", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/nezhahq/nezha/model"
|
||||
"github.com/nezhahq/nezha/pkg/utils"
|
||||
"github.com/nezhahq/nezha/service/singleton"
|
||||
)
|
||||
|
||||
@@ -68,7 +69,7 @@ func batchDeleteBlockedAddress(c *gin.Context) (any, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := model.BatchClearIP(singleton.DB, list); err != nil {
|
||||
if err := model.BatchClearIP(singleton.DB, utils.Unique(list)); err != nil {
|
||||
return nil, newGormError("%v", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user