引入ants(正式服已go get)携程池 已支持多店铺批量操作
This commit is contained in:
@@ -2992,7 +2992,7 @@ func GetVendorStoreSkusToStruct(ctx *jxcontext.Context, storeID, vendorID int) (
|
||||
if len(tmpList) == 0 { //数据库中无匹配项 直接将第三方数据进行导出
|
||||
goto creatExec
|
||||
} else { //进行比较
|
||||
if result := ComPareLocalWithVendors(tmpList, vendorStoreSkus); result != nil {
|
||||
if result := ComPareLocalWithVendors(tmpList, vendorStoreSkus, vendorID); result != nil {
|
||||
// 将返回的切片进行覆盖
|
||||
vendorStoreSkus = result
|
||||
goto creatExec
|
||||
@@ -3064,7 +3064,7 @@ func GetLocalStoreSkusByStoreID(storeID int) (tmp []*tGetStoresSkusInfoContainCa
|
||||
}
|
||||
|
||||
// 比较本地和第三方平台的差异 返回一个Excel 可接收实体
|
||||
func ComPareLocalWithVendors(localSku []*tGetStoresSkusInfoContainCategoryName, vendorSkus []*VendorStoreSkus) (result []*VendorStoreSkus) {
|
||||
func ComPareLocalWithVendors(localSku []*tGetStoresSkusInfoContainCategoryName, vendorSkus []*VendorStoreSkus, vendorID int) (result []*VendorStoreSkus) {
|
||||
// 进行取参比较
|
||||
var localStoreSkus []*VendorStoreSkus
|
||||
var updateStoreSkus []*VendorStoreSkus
|
||||
@@ -3074,8 +3074,8 @@ func ComPareLocalWithVendors(localSku []*tGetStoresSkusInfoContainCategoryName,
|
||||
SkuID: sku.StoreSkuExt.SkuID,
|
||||
SkuName: sku.SkuName.Name,
|
||||
Status: sku.Status,
|
||||
CategoryList: jxStatusTransForm(sku.CategoryName), //此处需要使用函数进行转换 进行查询根据类别ID去sku_category查询返回一个子类别放入List中
|
||||
Price: vendorPriceTransForm(&sku.StoreSkuExt, 1), //此处需要使用函数转换传入一个VendorID进行比较根据ID的不同返回对应不同的字段
|
||||
CategoryList: jxStatusTransForm(sku.CategoryName), //此处需要使用函数进行转换 进行查询根据类别ID去sku_category查询返回一个子类别放入List中
|
||||
Price: vendorPriceTransForm(&sku.StoreSkuExt, vendorID), //此处需要使用函数转换传入一个VendorID进行比较根据ID的不同返回对应不同的字段
|
||||
Reason: defaultReason,
|
||||
}
|
||||
localStoreSkus = append(localStoreSkus, skus)
|
||||
@@ -3108,11 +3108,13 @@ func ComPareLocalWithVendors(localSku []*tGetStoresSkusInfoContainCategoryName,
|
||||
buffer.WriteString("商品上下架状态不一致")
|
||||
count++
|
||||
}
|
||||
if value.CategoryList[0] != vendorSku.CategoryList[len(vendorSku.CategoryList)-1] {
|
||||
buffer.WriteString(strconv.Itoa(count))
|
||||
buffer.WriteString(".")
|
||||
buffer.WriteString("类别不一致:平台类别为" + vendorSku.CategoryList[len(vendorSku.CategoryList)-1])
|
||||
count++
|
||||
if vendorSku.CategoryList != nil { // Ebai 同步过得商品中的类别中都是nil
|
||||
if value.CategoryList[0] != vendorSku.CategoryList[len(vendorSku.CategoryList)-1] {
|
||||
buffer.WriteString(strconv.Itoa(count))
|
||||
buffer.WriteString(".")
|
||||
buffer.WriteString("类别不一致:平台类别为" + vendorSku.CategoryList[len(vendorSku.CategoryList)-1])
|
||||
count++
|
||||
}
|
||||
}
|
||||
value.Reason = buffer.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user