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