同步错误返回

This commit is contained in:
苏尹岚
2020-01-09 08:50:23 +08:00
parent 70376fb6e7
commit 77e4fb078f
2 changed files with 12 additions and 12 deletions

View File

@@ -775,22 +775,22 @@ func asyncStoreSkuOpFilter(ctx *jxcontext.Context, isAsync bool) bool {
return isAsync
}
func UpdateStoreSku(ctx *jxcontext.Context, storeID int, skuBindInfo *StoreSkuBindInfo, isAsync, isContinueWhenError bool) (hint, errCode string, err error) {
func UpdateStoreSku(ctx *jxcontext.Context, storeID int, skuBindInfo *StoreSkuBindInfo, isAsync, isContinueWhenError bool) (hint string, err error) {
return UpdateStoreSkus(ctx, storeID, []*StoreSkuBindInfo{skuBindInfo}, isAsync, isContinueWhenError)
}
func UpdateStoreSkus(ctx *jxcontext.Context, storeID int, skuBindInfos []*StoreSkuBindInfo, isAsync, isContinueWhenError bool) (hint, errCode string, err error) {
func UpdateStoreSkus(ctx *jxcontext.Context, storeID int, skuBindInfos []*StoreSkuBindInfo, isAsync, isContinueWhenError bool) (hint string, err error) {
return UpdateStoresSkus(ctx, []int{storeID}, skuBindInfos, false, isAsync, isContinueWhenError)
}
func UpdateStoresSkus(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isScale, isAsync, isContinueWhenError bool) (hint, errCode string, err error) {
func UpdateStoresSkus(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isScale, isAsync, isContinueWhenError bool) (hint string, err error) {
globals.SugarLogger.Debugf("UpdateStoresSkus:%s, storeIDs:%v, skuBindInfos:%s", ctx.GetTrackInfo(), storeIDs, utils.Format4Output(skuBindInfos, true))
var num int64
db := dao.GetDB()
skuIDs, err := updateStoresSkusWithoutSync(ctx, db, storeIDs, skuBindInfos, isScale)
if err != nil {
return "", "", err
return "", err
}
isAsync = asyncStoreSkuOpFilter(ctx, isAsync)
num = int64(len(skuIDs))
@@ -800,7 +800,7 @@ func UpdateStoresSkus(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*St
if num == 0 || !isAsync || hint == "" {
hint = utils.Int64ToStr(num)
}
return hint, "", err
return hint, err
}
func UpdateStoresSkusByBind(ctx *jxcontext.Context, skuBindInfos []*StoreSkuBindInfo, isAsync, isContinueWhenError bool) (hint string, err error) {
@@ -1693,7 +1693,7 @@ func AcceptStoreOpRequests(ctx *jxcontext.Context, reqIDs []int) (err error) {
}
}
if err2 == nil {
_, _, err2 := UpdateStoresSkus(ctx, []int{op.StoreID}, []*StoreSkuBindInfo{skuBindInfo}, false, false, false)
_, err2 := UpdateStoresSkus(ctx, []int{op.StoreID}, []*StoreSkuBindInfo{skuBindInfo}, false, false, false)
isLocalSucess := true
if err2 != nil {
subErrors[reqID] = err2

View File

@@ -151,9 +151,9 @@ func (c *StoreSkuController) UpdateStoreSku() {
c.callUpdateStoreSku(func(params *tStoreSkuUpdateStoreSkuParams) (retVal interface{}, errCode string, err error) {
var skuBindInfo cms.StoreSkuBindInfo
if err = jxutils.Strings2Objs(params.Payload, &skuBindInfo); err == nil {
retVal, errCode, err = cms.UpdateStoreSku(params.Ctx, params.StoreID, &skuBindInfo, params.IsAsync, params.IsContinueWhenError)
retVal, err = cms.UpdateStoreSku(params.Ctx, params.StoreID, &skuBindInfo, params.IsAsync, params.IsContinueWhenError)
}
return retVal, errCode, err
return retVal, "", err
})
}
@@ -171,9 +171,9 @@ func (c *StoreSkuController) UpdateStoreSkus() {
c.callUpdateStoreSkus(func(params *tStoreSkuUpdateStoreSkusParams) (retVal interface{}, errCode string, err error) {
var skuBindInfos []*cms.StoreSkuBindInfo
if err = jxutils.Strings2Objs(params.Payload, &skuBindInfos); err == nil {
retVal, errCode, err = cms.UpdateStoreSkus(params.Ctx, params.StoreID, skuBindInfos, params.IsAsync, params.IsContinueWhenError)
retVal, err = cms.UpdateStoreSkus(params.Ctx, params.StoreID, skuBindInfos, params.IsAsync, params.IsContinueWhenError)
}
return retVal, errCode, err
return retVal, "", err
})
}
@@ -219,8 +219,8 @@ func (c *StoreSkuController) UpdateStoresSkus() {
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.Payload, &skuBindInfos); err != nil {
return retVal, "", err
}
retVal, errCode, err = cms.UpdateStoresSkus(params.Ctx, storeIDs, skuBindInfos, params.IsScale, params.IsAsync, params.IsContinueWhenError)
return retVal, errCode, err
retVal, err = cms.UpdateStoresSkus(params.Ctx, storeIDs, skuBindInfos, params.IsScale, params.IsAsync, params.IsContinueWhenError)
return retVal, "", err
})
}