- 特殊处理同步价格至平台出错,较大改动
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
@@ -335,7 +336,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
if extErr, ok := err.(*utils.ErrorWithCode); ok && extErr.IntCode() == 1 && strings.Index(extErr.ErrMsg(), "折扣商品原价不允许修改") >= 0 {
|
||||
if isErrModifyPrice(err) {
|
||||
shouldCallSellStatus = true
|
||||
}
|
||||
}
|
||||
@@ -355,6 +356,8 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
if len(updateFields) > 0 {
|
||||
_, err = dao.UpdateEntity(db, storeSkuBind, updateFields...)
|
||||
}
|
||||
} else if isErrModifyPrice(err) {
|
||||
err = partner.NewErrorCode(err.Error(), partner.ErrCodeChangePriceFailed, model.VendorIDEBAI)
|
||||
}
|
||||
return nil, err
|
||||
}, skus)
|
||||
@@ -371,6 +374,18 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func isErrModifyPrice(err error) bool {
|
||||
if errExt, ok := err.(*utils.ErrorWithCode); ok && errExt.IntCode() == 1 {
|
||||
for _, v := range []string{
|
||||
"折扣商品原价不允许修改",
|
||||
} {
|
||||
if strings.Index(errExt.ErrMsg(), v) >= 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
func (p *PurchaseHandler) RefreshStoresAllSkusID(ctx *jxcontext.Context, parentTask tasksch.ITask, isAsync bool, storeIDs []int) (hint string, err error) {
|
||||
return hint, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user