From 9a562a4f49211a2fe8d3f06a265cc27e3e67c289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B9=B3=E5=87=A1=E6=A2=A6?= Date: Mon, 13 Jul 2020 09:47:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9UpdateSensitiveWord=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=85=A5=E5=8F=82=EF=BC=8CID=E6=88=90=E9=9D=9E?= =?UTF-8?q?=E5=BF=85=E5=A1=AB=EF=BC=8C=E4=B8=8D=E9=80=89=E7=9A=84=E8=AF=9D?= =?UTF-8?q?=EF=BC=8C=E9=BB=98=E8=AE=A4=E5=8F=AA=E6=94=B9vendorid=3D-2?= =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/sensitive_words.go | 15 ++++++--------- controllers/cms_sku.go | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) 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