商品类目映射修改
This commit is contained in:
@@ -949,8 +949,8 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
||||
valid := dao.StrictMakeMapByStructObject(payload, skuName, userName)
|
||||
valid = utils.RemoveGeneralMapKeys(valid, model.FieldSpecQuality, model.FieldSpecUnit)
|
||||
_, hasPlaces := payload["places"]
|
||||
updateOrCreateSkuVendorCategoryMap(db, ctx, nameID, payload, nil, false)
|
||||
if len(valid) > 0 || hasPlaces {
|
||||
flag := updateOrCreateSkuVendorCategoryMap(db, ctx, nameID, payload, nil, false)
|
||||
if len(valid) > 0 || hasPlaces || flag {
|
||||
if valid["Upc"] != nil {
|
||||
if upc, _ := valid["Upc"].(string); upc == "" {
|
||||
valid["Upc"] = nil
|
||||
@@ -1072,7 +1072,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
||||
return num, err
|
||||
}
|
||||
|
||||
func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, nameID int, payload map[string]interface{}, skuNameExt *model.SkuNameExt, isDelete bool) {
|
||||
func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, nameID int, payload map[string]interface{}, skuNameExt *model.SkuNameExt, isDelete bool) (flag bool) {
|
||||
if isDelete {
|
||||
skuVendorCatMaps, _ := dao.GetSkuVendorCategoryMaps(db, []int{nameID}, nil, nil)
|
||||
for _, v := range skuVendorCatMaps {
|
||||
@@ -1080,6 +1080,7 @@ func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, n
|
||||
v.LastOperator = ctx.GetUserName()
|
||||
dao.UpdateEntity(db, v, "DeletedAt", "LastOperator")
|
||||
}
|
||||
flag = true
|
||||
} else {
|
||||
updateOrCreate := func(vendorID, nameID int, vendorCatID string) {
|
||||
skuVendorCatMaps, _ := dao.GetSkuVendorCategoryMaps(db, []int{nameID}, []int{vendorID}, nil)
|
||||
@@ -1099,31 +1100,40 @@ func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, n
|
||||
if skuNameExt != nil {
|
||||
if skuNameExt.JdCategoryID != "" {
|
||||
updateOrCreate(model.VendorIDJD, nameID, skuNameExt.JdCategoryID)
|
||||
flag = true
|
||||
}
|
||||
if skuNameExt.JdsCategoryID != "" {
|
||||
updateOrCreate(model.VendorIDJDShop, nameID, skuNameExt.JdsCategoryID)
|
||||
flag = true
|
||||
}
|
||||
if skuNameExt.EbaiCategoryID != "" {
|
||||
updateOrCreate(model.VendorIDEBAI, nameID, skuNameExt.EbaiCategoryID)
|
||||
flag = true
|
||||
}
|
||||
if skuNameExt.MtwmCategoryID != "" {
|
||||
updateOrCreate(model.VendorIDMTWM, nameID, skuNameExt.MtwmCategoryID)
|
||||
flag = true
|
||||
}
|
||||
} else {
|
||||
if payload["jdCategoryID"] != nil {
|
||||
updateOrCreate(model.VendorIDJD, nameID, payload["jdCategoryID"].(string))
|
||||
flag = true
|
||||
}
|
||||
if payload["jdsCategoryID"] != nil {
|
||||
updateOrCreate(model.VendorIDJDShop, nameID, payload["jdsCategoryID"].(string))
|
||||
flag = true
|
||||
}
|
||||
if payload["ebaiCategoryID"] != nil {
|
||||
updateOrCreate(model.VendorIDEBAI, nameID, payload["ebaiCategoryID"].(string))
|
||||
flag = true
|
||||
}
|
||||
if payload["mtwmCategoryID"] != nil {
|
||||
updateOrCreate(model.VendorIDMTWM, nameID, payload["mtwmCategoryID"].(string))
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag
|
||||
}
|
||||
|
||||
func SetStoreSkuSyncStatus2(db *dao.DaoDB, storeIDs []int, vendorIDs, skuIDs []int, syncStatus int) (num int64, err error) {
|
||||
|
||||
Reference in New Issue
Block a user