Accept Merge Request #218: (qidongsheng -> jdshop)
Merge Request: 修改关键字 Created By: @漆东升 Accepted By: @苏尹岚 URL: https://rosydev.coding.net/p/jx-callback/d/jx-callback/git/merge/218
This commit is contained in:
@@ -731,9 +731,9 @@ func IsSensitiveWordInList(str string) (bool, string) {
|
||||
if err == nil {
|
||||
for _, value := range wordList {
|
||||
keyWord := value.Word
|
||||
checkHas := strings.Contains(str, keyWord)
|
||||
checkHas := strings.Contains(keyWord, str)
|
||||
if checkHas {
|
||||
return true, keyWord
|
||||
return true, str
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -679,6 +679,10 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
//handle error for sensitive words, if find, then insert to table sensitive_words
|
||||
if sensitiveWord := GetSensitiveWord(singleStoreHandler, err.Error()); sensitiveWord != "" {
|
||||
dao.InsertSensitiveWord(sensitiveWord, vendorID, ctx.GetUserName())
|
||||
words, _ := dao.GetSensitiveWordList(vendorID)
|
||||
word := words[0]
|
||||
word.Word = word.Word + "," + sensitiveWord
|
||||
dao.UpdateSensitiveWord(word, vendorID, 0, ctx.GetUserName())
|
||||
}
|
||||
}
|
||||
successList := putils.UnselectStoreSkuSyncListByVendorSkuIDs(batchedStoreSkuList, GetVendorSkuIDList(failedList))
|
||||
|
||||
@@ -3,6 +3,7 @@ package dao
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -46,7 +47,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 +57,15 @@ 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
|
||||
globals.SugarLogger.Debug("wordList:", wordList)
|
||||
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
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
|
||||
@@ -357,8 +358,8 @@ func (c *SkuController) GetSensitiveWordList() {
|
||||
// @Title 插入敏感词列表
|
||||
// @Description 插入敏感词列表
|
||||
// @Param token header string true "认证token"
|
||||
// @Param word query string true "关键词名字"
|
||||
// @Param vendorID query int false "VendorID"
|
||||
// @Param word formData string true "关键词名字"
|
||||
// @Param vendorID formData int false "VendorID"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /InsertSensitiveWord [post]
|
||||
@@ -372,26 +373,30 @@ func (c *SkuController) InsertSensitiveWord() {
|
||||
// @Title 修改敏感词列表
|
||||
// @Description 修改敏感词列表
|
||||
// @Param token header string true "认证token"
|
||||
// @Param word query string true "关键词名字"
|
||||
// @Param vendorID query int false "VendorID"
|
||||
// @Param ID query int false "关键词ID"
|
||||
// @Param Status query int false "状态,0为修改默认,1为删除"
|
||||
// @Param word formData string true "关键词名字"
|
||||
// @Param vendorID formData int false "VendorID"
|
||||
// @Param ID formData int false "关键词ID"
|
||||
// @Param Status formData int false "状态,0为修改默认,1为删除"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /UpdateSensitiveWord [put]
|
||||
func (c *SkuController) UpdateSensitiveWord() {
|
||||
c.callUpdateSensitiveWord(func(params *tSkuUpdateSensitiveWordParams) (retVal interface{}, errCode string, err error) {
|
||||
word := &model.SensitiveWord{
|
||||
VendorID: params.VendorID,
|
||||
Word: params.Word,
|
||||
ModelIDCULD: model.ModelIDCULD{
|
||||
ID: params.ID,
|
||||
},
|
||||
//word := &model.SensitiveWord{
|
||||
// VendorID: params.VendorID,
|
||||
// Word: params.Word,
|
||||
//}
|
||||
globals.SugarLogger.Debug("UpdateSensitiveWord入参params:", params)
|
||||
words, err := dao.GetSensitiveWordList(params.VendorID)
|
||||
word := words[0]
|
||||
word.Word = params.Word
|
||||
if params.ID != 0 {
|
||||
word.ModelIDCULD.ID = params.ID
|
||||
}
|
||||
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
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user