商品绑定分类映射

This commit is contained in:
苏尹岚
2020-07-28 10:14:03 +08:00
parent 3b5d7dd15f
commit a8664cef65
2 changed files with 50 additions and 0 deletions

View File

@@ -981,6 +981,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
return 0, err
}
}
updateOrCreateSkuVendorCategoryMap(db, ctx, nameID, payload, false)
if utils.Interface2Int64WithDefault(payload["isGlobal"], 0) == 0 && payload["places"] != nil {
if places, ok := payload["places"].([]interface{}); ok {
if _, err = dao.DeleteSkuNamePlace(db, nameID, nil); err != nil {
@@ -1052,6 +1053,28 @@ 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{}, isDelete bool) {
if isDelete {
} else {
if payload["jdCategoryID"].(string) != "" {
skuVendorCatMaps, _ := dao.GetSkuVendorCategoryMaps(db, []int{nameID}, []int{model.VendorIDJD}, nil)
if len(skuVendorCatMaps) > 0 {
skuVendorCatMaps[0].VendorCategoryID = payload["jdCategoryID"].(string)
dao.UpdateEntity(db, skuVendorCatMaps[0], "VendorCategoryID")
} else {
skuVendorCatMap := &model.SkuVendorCategoryMap{
NameID: nameID,
VendorID: model.VendorIDJD,
VendorCategoryID: payload["jdCategoryID"].(string),
}
dao.WrapAddIDCULDEntity(skuVendorCatMap, ctx.GetUserName())
}
}
}
}
func SetStoreSkuSyncStatus2(db *dao.DaoDB, storeIDs []int, vendorIDs, skuIDs []int, syncStatus int) (num int64, err error) {
for _, vendorID := range vendorIDs {
num2, err2 := dao.SetStoreSkuSyncStatus(db, vendorID, storeIDs, skuIDs, syncStatus)