Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Fix multiple query conditions in the log file

lotk2e69ad8265f7
diff --git a/core/internal/controller/operation_log/operation_log_v1_get_operation_log.go b/core/internal/controller/operation_log/operation_log_v1_get_operation_log.go
index 8ba2e2b4..74056ea7 100644
--- a/core/internal/controller/operation_log/operation_log_v1_get_operation_log.go
+++ b/core/internal/controller/operation_log/operation_log_v1_get_operation_log.go
@@ -1,14 +1,13 @@
package operation_log
import (
+ "billionmail-core/api/operation_log/v1"
"billionmail-core/internal/model/entity"
"billionmail-core/internal/service/public"
"context"
"github.com/gogf/gf/v2/frame/g"
"strconv"
"time"
-
- "billionmail-core/api/operation_log/v1"
)
func (c *ControllerV1) GetOperationLog(ctx context.Context, req *v1.GetOperationLogReq) (res *v1.GetOperationLogRes, err error) {
@@ -19,8 +18,7 @@ func (c *ControllerV1) GetOperationLog(ctx context.Context, req *v1.GetOperation
// add keyword fuzzy search (log, ip fields)
if req.Keyword != "" {
- model = model.WhereLike("log", "%"+req.Keyword+"%").
- WhereOrLike("ip", "%"+req.Keyword+"%")
+ model = model.Where("(log LIKE ? OR ip LIKE ?)", "%"+req.Keyword+"%", "%"+req.Keyword+"%")
}
// type filter