mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-27 07:26:36 +08:00
访问日志关键词支持完整的URL/优化Like语句
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
dbutils "github.com/TeaOSLab/EdgeAPI/internal/db/utils"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/errors"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/utils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
|
||||
@@ -221,7 +222,7 @@ func (this *IPListDAO) CountAllEnabledIPLists(tx *dbs.Tx, listType string, isPub
|
||||
Attr("isPublic", isPublic)
|
||||
if len(keyword) > 0 {
|
||||
query.Where("(name LIKE :keyword OR description LIKE :keyword)").
|
||||
Param("keyword", "%"+keyword+"%")
|
||||
Param("keyword", dbutils.QuoteLike(keyword))
|
||||
}
|
||||
return query.Count()
|
||||
}
|
||||
@@ -234,7 +235,7 @@ func (this *IPListDAO) ListEnabledIPLists(tx *dbs.Tx, listType string, isPublic
|
||||
Attr("isPublic", isPublic)
|
||||
if len(keyword) > 0 {
|
||||
query.Where("(name LIKE :keyword OR description LIKE :keyword)").
|
||||
Param("keyword", "%"+keyword+"%")
|
||||
Param("keyword", dbutils.QuoteLike(keyword))
|
||||
}
|
||||
_, err = query.Offset(offset).
|
||||
Limit(size).
|
||||
|
||||
Reference in New Issue
Block a user