修改sensitive入参-1所有,-2默认查询新模式,所以只有一条数据
This commit is contained in:
@@ -727,7 +727,7 @@ func CheckHasSensitiveWord(word string) (bool, error) {
|
||||
}
|
||||
|
||||
func IsSensitiveWordInList(str string) (bool, string) {
|
||||
wordList, err := dao.GetSensitiveWordList(3)
|
||||
wordList, err := dao.GetSensitiveWordList(-1)
|
||||
if err == nil {
|
||||
for _, value := range wordList {
|
||||
keyWord := value.Word
|
||||
|
||||
@@ -7,12 +7,12 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
/*VendorID = 2 的时候是通用,3 查询所有,保留之前的1,看后面会不会有扩展*/
|
||||
/*VendorID = -2 的时候是通用,-1 查询所有,保留之前的1,看后面会不会有扩展*/
|
||||
func GetSensitiveWordList(vendorID int) (wordList []*model.SensitiveWord, err error) {
|
||||
if vendorID == 0 {
|
||||
vendorID = 2
|
||||
vendorID = -2
|
||||
}
|
||||
if vendorID == 3 {
|
||||
if vendorID == -1 {
|
||||
sql := `SELECT * FROM sensitive_word WHERE deleted_at = ?`
|
||||
err = GetRows(nil, &wordList, sql, utils.DefaultTimeValue)
|
||||
} else {
|
||||
@@ -24,7 +24,7 @@ func GetSensitiveWordList(vendorID int) (wordList []*model.SensitiveWord, err er
|
||||
|
||||
func InsertSensitiveWord(word string, vendorID int, userName string) error {
|
||||
if vendorID == 0 {
|
||||
vendorID = 2
|
||||
vendorID = -2
|
||||
}
|
||||
sensitiveWord := &model.SensitiveWord{Word: word, VendorID: vendorID}
|
||||
WrapAddIDCULDEntity(sensitiveWord, userName)
|
||||
@@ -36,7 +36,7 @@ func DeleteSensitiveWord(wordList *model.SensitiveWord, id int, userName string,
|
||||
return nil, errors.New("入参错误,找不到相应ID")
|
||||
}
|
||||
if vendorID == 0 {
|
||||
vendorID = 2
|
||||
vendorID = -2
|
||||
}
|
||||
wordList.ID = id
|
||||
wordList.VendorID = id
|
||||
@@ -53,7 +53,7 @@ func UpdateSensitiveWord(wordList *model.SensitiveWord, vendorID int, id int, us
|
||||
return nil, errors.New("入参错误,找不到相应ID")
|
||||
}
|
||||
if vendorID == 0 {
|
||||
vendorID = 2
|
||||
vendorID = -2
|
||||
}
|
||||
wordList.ID = id
|
||||
wordList.VendorID = vendorID
|
||||
|
||||
Reference in New Issue
Block a user