屏蔽词功能ok

This commit is contained in:
2026-06-04 15:20:40 +08:00
parent c3cdcfd379
commit 2e6eab3e01
8 changed files with 505 additions and 31 deletions
+15
View File
@@ -30,6 +30,11 @@ func (s *store) CountNodeBlocking(opts listOptions) (int64, error) {
return total, s.db.Model(&nodeBlockingRecord{}).Count(&total).Error
}
func (s *store) ListEnabledNodeBlocking() ([]nodeBlockingRecord, error) {
var rows []nodeBlockingRecord
return rows, s.db.Where("enabled = ?", true).Find(&rows).Error
}
func (s *store) CreateNodeBlocking(nodeID string, nodeNum *int64, reason string, enabled bool) (*nodeBlockingRecord, error) {
nodeID = strings.TrimSpace(nodeID)
if nodeID == "" {
@@ -93,6 +98,11 @@ func (s *store) CountIPBlocking(opts listOptions) (int64, error) {
return total, s.db.Model(&ipBlockingRecord{}).Count(&total).Error
}
func (s *store) ListEnabledIPBlocking() ([]ipBlockingRecord, error) {
var rows []ipBlockingRecord
return rows, s.db.Where("enabled = ?", true).Find(&rows).Error
}
func (s *store) CreateIPBlocking(ipValue string, reason string, enabled bool) (*ipBlockingRecord, error) {
value, err := normalizeIPBlockingValue(ipValue)
if err != nil {
@@ -156,6 +166,11 @@ func (s *store) CountForbiddenWordBlocking(opts listOptions) (int64, error) {
return total, s.db.Model(&forbiddenWordBlockingRecord{}).Count(&total).Error
}
func (s *store) ListEnabledForbiddenWordBlocking() ([]forbiddenWordBlockingRecord, error) {
var rows []forbiddenWordBlockingRecord
return rows, s.db.Where("enabled = ?", true).Find(&rows).Error
}
func (s *store) CreateForbiddenWordBlocking(word, matchType string, caseSensitive bool, reason string, enabled bool) (*forbiddenWordBlockingRecord, error) {
word = strings.TrimSpace(word)
if word == "" {