1
This commit is contained in:
@@ -98,6 +98,13 @@ func GetVendorCategories(ctx *jxcontext.Context, vendorID int, parentID string)
|
||||
return vendorCats, dao.GetEntitiesByKV(nil, &vendorCats, cond, false)
|
||||
}
|
||||
|
||||
// 获取正确分类根据分类名称
|
||||
func GetVendorCategoriesByName(vendorId int, name string) (vendorCats *model.SkuVendorCategory, err error) {
|
||||
sql := ` SELECT * FROM sku_vendor_category WHERE vendor_id = ? AND name LIKE ? `
|
||||
err = dao.GetRow(dao.GetDB(), &vendorCats, sql, []interface{}{vendorId, "%" + name + "%"}...)
|
||||
return vendorCats, err
|
||||
}
|
||||
|
||||
// parentID 为-1表示所有
|
||||
func GetCategories(ctx *jxcontext.Context, parentID int, isExd bool) (catList []*dao.SkuCategoryWithVendor, err error) {
|
||||
db := dao.GetDB()
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
sku_syncStock_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/sku_syncStock/request"
|
||||
tiktokShop "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
@@ -17,6 +18,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/partner/putils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -433,3 +435,39 @@ func (p *PurchaseHandler) UpdateStoreSkusSpecTag(ctx *jxcontext.Context, vendorO
|
||||
//}
|
||||
return err
|
||||
}
|
||||
|
||||
func GetProductAuditList(vendorOrgCode string) (string, error) {
|
||||
var page int64 = 1
|
||||
var pageSize int64 = 100
|
||||
|
||||
updateCategory := make(map[string]string, 0) // 修改分类的Map
|
||||
for {
|
||||
data, err := getAPI(vendorOrgCode, 0, "").GetProductAuditList(page, pageSize, 2)
|
||||
if err != nil || len(data) == 0 {
|
||||
break
|
||||
}
|
||||
for _, v := range data {
|
||||
if _, ok := v.AuditReason["综合原因"]; ok {
|
||||
if strings.Contains(v.AuditReason["综合原因"][0], "该商品类目选择错误,推荐放置在") {
|
||||
list := strings.Split(v.AuditReason["综合原因"][0], `“`)
|
||||
categoryNameList := strings.Split(list[1], "/")
|
||||
vendorCatgory, err := cms.GetVendorCategoriesByName(14, categoryNameList[len(categoryNameList)])
|
||||
if err != nil {
|
||||
return utils.Format4Output(updateCategory, false), err
|
||||
}
|
||||
if vendorCatgory != nil {
|
||||
updateCategory[utils.Int64ToStr(v.ProductId)] = vendorCatgory.VendorCategoryID
|
||||
} else {
|
||||
updateCategory[utils.Int64ToStr(v.ProductId)] = "-1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if len(data) >= 100 {
|
||||
page++
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("=================111:= %s", utils.Format4Output(updateCategory, false))
|
||||
return utils.Format4Output(updateCategory, false), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user