敏感词修改代码结构
This commit is contained in:
@@ -19,6 +19,10 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/partner"
|
"git.rosy.net.cn/jx-callback/business/partner"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
subSensitiveWordRegexp = regexp.MustCompile(`[^\[\]\"\}]`)
|
||||||
|
)
|
||||||
|
|
||||||
func CreateStoreCategoryByStoreSku(ctx *jxcontext.Context, vendorID, storeID int, vendorStoreID string, nameIDs, skuIDs []int) (err error) {
|
func CreateStoreCategoryByStoreSku(ctx *jxcontext.Context, vendorID, storeID int, vendorStoreID string, nameIDs, skuIDs []int) (err error) {
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
dao.Begin(db)
|
dao.Begin(db)
|
||||||
@@ -587,11 +591,10 @@ func ClearRemoteStoreStuffAndSetNew(ctx *jxcontext.Context, parentTask tasksch.I
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetSensitiveWord(singleStoreHandler partner.ISingleStoreStoreSkuHandler, str string) string {
|
func GetSensitiveWord(singleStoreHandler partner.ISingleStoreStoreSkuHandler, str string) string {
|
||||||
var regFindKeyWord = singleStoreHandler.GetSensitiveWordRegexp()
|
sensitiveWordRegexp := singleStoreHandler.GetSensitiveWordRegexp()
|
||||||
var subRegFindKeyWord = regexp.MustCompile(`[^\[\]\"\}]`)
|
findResult := sensitiveWordRegexp.FindStringSubmatch(str)
|
||||||
findResult := regFindKeyWord.FindStringSubmatch(str)
|
|
||||||
if findResult != nil && len(findResult) > 1 {
|
if findResult != nil && len(findResult) > 1 {
|
||||||
findSubResult := subRegFindKeyWord.FindAllString(findResult[1], -1)
|
findSubResult := subSensitiveWordRegexp.FindAllString(findResult[1], -1)
|
||||||
return strings.Join(findSubResult, "")
|
return strings.Join(findSubResult, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ var (
|
|||||||
2: 15347484581335, // 蔬菜类
|
2: 15347484581335, // 蔬菜类
|
||||||
3: 15347484581339, // 其他蔬菜类休闲食品
|
3: 15347484581339, // 其他蔬菜类休闲食品
|
||||||
}
|
}
|
||||||
|
sensitiveWordRegexp = regexp.MustCompile(`商品名称中含有敏感词(\[.*\])`)
|
||||||
)
|
)
|
||||||
|
|
||||||
func (p *PurchaseHandler) GetStoreSkusBatchSize(funcID int) (batchSize int) {
|
func (p *PurchaseHandler) GetStoreSkusBatchSize(funcID int) (batchSize int) {
|
||||||
@@ -389,5 +390,5 @@ func vendorSkuList2Jx(vendorSkuList []*ebaiapi.SkuInfo) (skuNameList []*partner.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) GetSensitiveWordRegexp() *regexp.Regexp {
|
func (p *PurchaseHandler) GetSensitiveWordRegexp() *regexp.Regexp {
|
||||||
return regexp.MustCompile(`商品名称中含有敏感词(\[.*\])`)
|
return sensitiveWordRegexp
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,10 @@ const (
|
|||||||
defVendorCatID = 200001903 // 生菜
|
defVendorCatID = 200001903 // 生菜
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
sensitiveWordRegexp = regexp.MustCompile(`包含敏感词:(\[.*\])`)
|
||||||
|
)
|
||||||
|
|
||||||
func (p *PurchaseHandler) GetStoreSkusBatchSize(funcID int) (batchSize int) {
|
func (p *PurchaseHandler) GetStoreSkusBatchSize(funcID int) (batchSize int) {
|
||||||
switch funcID {
|
switch funcID {
|
||||||
case partner.FuncUpdateStoreSkusStock, partner.FuncUpdateStoreSkusStatus, partner.FuncUpdateStoreSkusPrice:
|
case partner.FuncUpdateStoreSkusStock, partner.FuncUpdateStoreSkusStatus, partner.FuncUpdateStoreSkusPrice:
|
||||||
@@ -368,5 +372,5 @@ func vendorSkuList2Jx(appFoodList []*mtwmapi.AppFood) (skuNameList []*partner.Sk
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) GetSensitiveWordRegexp() *regexp.Regexp {
|
func (p *PurchaseHandler) GetSensitiveWordRegexp() *regexp.Regexp {
|
||||||
return regexp.MustCompile(`包含敏感词:(\[.*\])`)
|
return sensitiveWordRegexp
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user