修复配置更新错误问题

This commit is contained in:
2025-08-19 17:25:01 +08:00
parent 95c1a34ea4
commit 261ee88a4b
3 changed files with 36 additions and 9 deletions

View File

@@ -56,10 +56,7 @@ func DisableEdgesByMacs(tx *gorm.DB, macs []string) error {
// 分批处理MAC地址列表
for i := 0; i < len(macs); i += batchSize {
end := i + batchSize
if end > len(macs) {
end = len(macs)
}
end := min(i+batchSize, len(macs))
batch := macs[i:end]
err := tx.Model(&model.Edge{}).Where("macaddr IN ?", batch).Update("active", false).Error