修改UpdateSensitiveWord方法入参,ID成非必填,不选的话,默认只改vendorid=-2的

This commit is contained in:
平凡梦
2020-07-13 09:47:50 +08:00
parent 87d05b2166
commit 9a562a4f49
2 changed files with 7 additions and 10 deletions

View File

@@ -1,7 +1,6 @@
package dao
import (
"errors"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
"time"
@@ -32,13 +31,12 @@ func InsertSensitiveWord(word string, vendorID int, userName string) error {
}
func DeleteSensitiveWord(wordList *model.SensitiveWord, id int, userName string, vendorID int) (word *model.SensitiveWord, err error) {
if id == 0 {
return nil, errors.New("入参错误找不到相应ID")
}
if vendorID == 0 {
vendorID = -2
}
wordList.ID = id
if id != 0 {
wordList.ID = id
}
wordList.VendorID = id
wordList.DeletedAt = time.Now()
wordList.LastOperator = userName
@@ -49,13 +47,12 @@ func DeleteSensitiveWord(wordList *model.SensitiveWord, id int, userName string,
}
func UpdateSensitiveWord(wordList *model.SensitiveWord, vendorID int, id int, userName string, params ...string) (word *model.SensitiveWord, err error) {
if id == 0 {
return nil, errors.New("入参错误找不到相应ID")
}
if vendorID == 0 {
vendorID = -2
}
wordList.ID = id
if id != 0 {
wordList.ID = id
}
wordList.VendorID = vendorID
wordList.UpdatedAt = time.Now()
wordList.LastOperator = userName