Commit 5a77e771 authored by qiuqunfeng's avatar qiuqunfeng
Browse files

Refactor EnableBlackWhiteList method to use Model update for status change

- Update the database operation in the EnableBlackWhiteList method to use Model and Where clauses for a more precise status update.
- Improve the clarity and efficiency of the database interaction within the WAF service.
parent 36d06aee
...@@ -1152,7 +1152,7 @@ func (s *wafService) EnableBlackWhiteList(ctx context.Context, req *MatcherExpr) ...@@ -1152,7 +1152,7 @@ func (s *wafService) EnableBlackWhiteList(ctx context.Context, req *MatcherExpr)
} }
} }
} }
err = s.db.WithContext(ctx).Save(&matcherExpr).Error err = s.db.WithContext(ctx).Model(&model.MatcherExpr{}).Where("id = ?", req.ID).Update("status", req.Status).Error
if err != nil { if err != nil {
return err return err
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment