diff --git a/business/model/dao/sensitive_words.go b/business/model/dao/sensitive_words.go index 344ee5c55..e7e5f893f 100644 --- a/business/model/dao/sensitive_words.go +++ b/business/model/dao/sensitive_words.go @@ -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 diff --git a/controllers/cms_sku.go b/controllers/cms_sku.go index f8cf75f0d..d25127852 100644 --- a/controllers/cms_sku.go +++ b/controllers/cms_sku.go @@ -374,7 +374,7 @@ func (c *SkuController) InsertSensitiveWord() { // @Param token header string true "认证token" // @Param word query string true "关键词名字" // @Param vendorID query int false "VendorID" -// @Param ID query int true "关键词ID" +// @Param ID query int false "关键词ID" // @Param Status query int false "状态,0为修改默认,1为删除" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult