1
This commit is contained in:
@@ -956,6 +956,7 @@ func AddSkuName(ctx *jxcontext.Context, skuNameExt *model.SkuNameExt, userName s
|
|||||||
}
|
}
|
||||||
|
|
||||||
func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interface{}, isExd bool) (num int64, err error) {
|
func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interface{}, isExd bool) (num int64, err error) {
|
||||||
|
globals.SugarLogger.Debugf("===========================1 %s", utils.Format4Output(time.Now(), false))
|
||||||
userName := ctx.GetUserName()
|
userName := ctx.GetUserName()
|
||||||
skuName := &model.SkuName{}
|
skuName := &model.SkuName{}
|
||||||
skuName.ID = nameID
|
skuName.ID = nameID
|
||||||
@@ -972,6 +973,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
|||||||
payload["name"] = newSkuName
|
payload["name"] = newSkuName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf("===========================2 %s", utils.Format4Output(time.Now(), false))
|
||||||
|
|
||||||
delete(payload, "isSpu")
|
delete(payload, "isSpu")
|
||||||
delete(payload, "seq")
|
delete(payload, "seq")
|
||||||
@@ -980,6 +982,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
|||||||
valid = utils.RemoveGeneralMapKeys(valid, model.FieldSpecQuality, model.FieldSpecUnit)
|
valid = utils.RemoveGeneralMapKeys(valid, model.FieldSpecQuality, model.FieldSpecUnit)
|
||||||
_, hasPlaces := payload["places"]
|
_, hasPlaces := payload["places"]
|
||||||
flag := updateOrCreateSkuVendorCategoryMap(db, ctx, nameID, payload, nil, false)
|
flag := updateOrCreateSkuVendorCategoryMap(db, ctx, nameID, payload, nil, false)
|
||||||
|
globals.SugarLogger.Debugf("===========================3 %s", utils.Format4Output(time.Now(), false))
|
||||||
if len(valid) > 0 || hasPlaces || flag {
|
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 == "" {
|
||||||
@@ -1016,6 +1019,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf("===========================4 %s", utils.Format4Output(time.Now(), false))
|
||||||
var eclpID string
|
var eclpID string
|
||||||
if payload["eclpID"] != nil {
|
if payload["eclpID"] != nil {
|
||||||
eclpID = payload["eclpID"].(string)
|
eclpID = payload["eclpID"].(string)
|
||||||
@@ -1042,6 +1046,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
|||||||
dao.Rollback(db, txDB)
|
dao.Rollback(db, txDB)
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf("===========================5 %s", utils.Format4Output(time.Now(), false))
|
||||||
if !isExd && eclpID == "" {
|
if !isExd && eclpID == "" {
|
||||||
if err = OnUpdateThing(ctx, db, nil, int64(nameID), model.ThingTypeSkuName); err != nil {
|
if err = OnUpdateThing(ctx, db, nil, int64(nameID), model.ThingTypeSkuName); err != nil {
|
||||||
dao.Rollback(db, txDB)
|
dao.Rollback(db, txDB)
|
||||||
@@ -1069,6 +1074,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf("===========================6 %s", utils.Format4Output(time.Now(), false))
|
||||||
skuList, err2 := dao.GetSkus(db, nil, []int{nameID}, nil, nil, nil)
|
skuList, err2 := dao.GetSkus(db, nil, []int{nameID}, nil, nil, nil)
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
for _, v := range skuList {
|
for _, v := range skuList {
|
||||||
@@ -1088,11 +1094,13 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf("===========================7 %s", utils.Format4Output(time.Now(), false))
|
||||||
skuIDs, err2 := dao.GetSkuIDByNames(db, []int{nameID})
|
skuIDs, err2 := dao.GetSkuIDByNames(db, []int{nameID})
|
||||||
if err = err2; err != nil {
|
if err = err2; err != nil {
|
||||||
dao.Rollback(db, txDB)
|
dao.Rollback(db, txDB)
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf("===========================8 %s", utils.Format4Output(time.Now(), false))
|
||||||
if len(skuIDs) > 0 {
|
if len(skuIDs) > 0 {
|
||||||
// 判断是否改价
|
// 判断是否改价
|
||||||
if payload["price"] != nil {
|
if payload["price"] != nil {
|
||||||
@@ -1116,11 +1124,13 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globals.SugarLogger.Debugf("===========================9 %s", utils.Format4Output(time.Now(), false))
|
||||||
// 更新skuIds对应在store_sku_bind中的价格体系,解决老版本改价之前关注的商品,在价格修改后,store_sku_bind中京西价未修改的问题
|
// 更新skuIds对应在store_sku_bind中的价格体系,解决老版本改价之前关注的商品,在价格修改后,store_sku_bind中京西价未修改的问题
|
||||||
if _, err = SetStoreSkuSyncStatus2(db, nil, partner.GetSingleStoreVendorIDs(), skuIDs, model.SyncFlagModifiedMask); err != nil {
|
if _, err = SetStoreSkuSyncStatus2(db, nil, partner.GetSingleStoreVendorIDs(), skuIDs, model.SyncFlagModifiedMask); err != nil {
|
||||||
dao.Rollback(db, txDB)
|
dao.Rollback(db, txDB)
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf("===========================10 %s", utils.Format4Output(time.Now(), false))
|
||||||
}
|
}
|
||||||
dao.Commit(db, txDB)
|
dao.Commit(db, txDB)
|
||||||
|
|
||||||
@@ -1128,6 +1138,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
|||||||
errList.AddErr(err)
|
errList.AddErr(err)
|
||||||
//_, err = CurVendorSync.SyncSku(ctx, db, nameID, -1, false, false, userName)
|
//_, err = CurVendorSync.SyncSku(ctx, db, nameID, -1, false, false, userName)
|
||||||
//errList.AddErr(err)
|
//errList.AddErr(err)
|
||||||
|
globals.SugarLogger.Debugf("===========================11 %s", utils.Format4Output(time.Now(), false))
|
||||||
|
|
||||||
storeIds, err := GetSyncSkuStoreId(db, skuIDs)
|
storeIds, err := GetSyncSkuStoreId(db, skuIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1135,11 +1146,13 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
|||||||
}
|
}
|
||||||
_, err2 = CurVendorSync.SyncStoresSkus(jxcontext.AdminCtx, nil, 0, db, partner.GetSingleStoreVendorIDs(), storeIds, skuIDs, false, false, true)
|
_, err2 = CurVendorSync.SyncStoresSkus(jxcontext.AdminCtx, nil, 0, db, partner.GetSingleStoreVendorIDs(), storeIds, skuIDs, false, false, true)
|
||||||
errList.AddErr(err2)
|
errList.AddErr(err2)
|
||||||
|
globals.SugarLogger.Debugf("===========================12 %s", utils.Format4Output(time.Now(), false))
|
||||||
err = errList.GetErrListAsOne()
|
err = errList.GetErrListAsOne()
|
||||||
if globals.IsAddEvent {
|
if globals.IsAddEvent {
|
||||||
mapBefore := refutil.FindMapAndStructMixed(valid, beforSkuName)
|
mapBefore := refutil.FindMapAndStructMixed(valid, beforSkuName)
|
||||||
err = AddEventDetail(db, ctx, model.OperateUpdate, nameID, model.ThingTypeSkuName, 0, BuildDiffData(mapBefore), BuildDiffData(valid))
|
err = AddEventDetail(db, ctx, model.OperateUpdate, nameID, model.ThingTypeSkuName, 0, BuildDiffData(mapBefore), BuildDiffData(valid))
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf("===========================13 %s", utils.Format4Output(time.Now(), false))
|
||||||
}
|
}
|
||||||
return num, err
|
return num, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user