- ebai.isErrModifyPrice
This commit is contained in:
@@ -284,7 +284,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
if _, err = api.EbaiAPI.SkuUpdate(strStoreID, storeSku.EbaiID, genSkuParamsFromStoreSkuInfo(storeSku)); err != nil {
|
||||
// 如果是改价错误,尝试把价格标志去掉再同步
|
||||
if errExt, ok := err.(*utils.ErrorWithCode); ok && errExt.IntCode() == 1 && strings.Index(errExt.ErrMsg(), "无法修改价格") >= 0 {
|
||||
if err != nil && isErrModifyPrice(err) {
|
||||
storeSku.EbaiSyncStatus = storeSku.EbaiSyncStatus & ^model.SyncFlagPriceMask
|
||||
if storeSku.EbaiSyncStatus != 0 {
|
||||
if _, err2 := api.EbaiAPI.SkuUpdate(strStoreID, storeSku.EbaiID, genSkuParamsFromStoreSkuInfo(storeSku)); err2 != nil {
|
||||
@@ -335,6 +335,20 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
return rootTask.ID, err
|
||||
}
|
||||
|
||||
func isErrModifyPrice(err error) bool {
|
||||
if errExt, ok := err.(*utils.ErrorWithCode); ok && errExt.IntCode() == 1 {
|
||||
for _, v := range []string{
|
||||
"无法修改价格",
|
||||
"sku_参加营销活动",
|
||||
} {
|
||||
if strings.Index(errExt.ErrMsg(), v) >= 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetAllRemoteSkus(ctx *jxcontext.Context, storeID int, parentTask tasksch.ITask) (skus []*ebaiapi.SkuInfo, err error) {
|
||||
globals.SugarLogger.Debugf("ebai GetAllRemoteSkus storeID:%d, userName:%s", storeID, ctx.GetUserName())
|
||||
page1, err := api.EbaiAPI.SkuList(utils.Int2Str(storeID), &ebaiapi.SkuListParams{
|
||||
|
||||
Reference in New Issue
Block a user