修改UpdateSensitiveWord

This commit is contained in:
平凡梦
2020-07-13 13:52:14 +08:00
parent 6023f6b813
commit b2671b5a7c
2 changed files with 10 additions and 4 deletions

View File

@@ -46,7 +46,7 @@ func DeleteSensitiveWord(wordList *model.SensitiveWord, id int, userName string,
return wordList, nil
}
func UpdateSensitiveWord(wordList *model.SensitiveWord, vendorID int, id int, userName string, params ...string) (word *model.SensitiveWord, err error) {
func UpdateSensitiveWord(wordList *model.SensitiveWord, vendorID int, id int, userName string) (word *model.SensitiveWord, err error) {
if vendorID == 0 {
vendorID = -2
}
@@ -56,8 +56,14 @@ func UpdateSensitiveWord(wordList *model.SensitiveWord, vendorID int, id int, us
wordList.VendorID = vendorID
wordList.UpdatedAt = time.Now()
wordList.LastOperator = userName
if _, err := UpdateEntity(nil, wordList, params...); err != nil {
return nil, err
if id != 0 {
if _, err := UpdateEntity(nil, wordList, "id", "word", "vendor_id", "last_operator"); err != nil {
return nil, err
}
} else {
if _, err := UpdateEntity(nil, wordList, "word", "vendor_id", "last_operator"); err != nil {
return nil, err
}
}
return wordList, err
}

View File

@@ -391,7 +391,7 @@ func (c *SkuController) UpdateSensitiveWord() {
if params.Status == 1 {
retVal, err = dao.DeleteSensitiveWord(word, params.ID, params.Ctx.GetUserName(), params.VendorID)
} else {
retVal, err = dao.UpdateSensitiveWord(word, params.VendorID, params.ID, params.Ctx.GetUserName(), "id", "word", "vendor_id", "last_operator")
retVal, err = dao.UpdateSensitiveWord(word, params.VendorID, params.ID, params.Ctx.GetUserName())
}
return retVal, "", err
})