sensitive的新增和修改方法
This commit is contained in:
@@ -19,26 +19,28 @@ func InsertSensitiveWord(word string, vendorID int, userName string) error {
|
||||
return CreateEntity(nil, sensitiveWord)
|
||||
}
|
||||
|
||||
func DeleteSensitiveWord(wordList *model.SensitiveWord, id int) error {
|
||||
func DeleteSensitiveWord(wordList *model.SensitiveWord, id int, userName string) (word *model.SensitiveWord, err error) {
|
||||
if id == 0 {
|
||||
return errors.New("入参错误,找不到相应ID")
|
||||
return nil, errors.New("入参错误,找不到相应ID")
|
||||
}
|
||||
wordList.ID = id
|
||||
wordList.DeletedAt = time.Now()
|
||||
if _, err := UpdateEntity(nil, wordList, "deleted_at"); err != nil {
|
||||
return err
|
||||
wordList.LastOperator = userName
|
||||
if _, err := UpdateEntity(nil, wordList, "deleted_at", "id", "last_operator", "vendor_id"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil
|
||||
return wordList, nil
|
||||
}
|
||||
|
||||
func UpdateSensitiveWord(wordList *model.SensitiveWord, id int, params ...string) error {
|
||||
func UpdateSensitiveWord(wordList *model.SensitiveWord, id int, userName string, params ...string) (word *model.SensitiveWord, err error) {
|
||||
if id == 0 {
|
||||
return errors.New("入参错误,找不到相应ID")
|
||||
return nil, errors.New("入参错误,找不到相应ID")
|
||||
}
|
||||
wordList.ID = id
|
||||
wordList.DeletedAt = time.Now()
|
||||
wordList.UpdatedAt = time.Now()
|
||||
wordList.LastOperator = userName
|
||||
if _, err := UpdateEntity(nil, wordList, params...); err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
return nil
|
||||
return wordList, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user