- first update shop id, then status, then other property for ebai shop, because shop property can not be changed after approved
This commit is contained in:
@@ -156,47 +156,47 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
`
|
||||
if err = dao.GetRows(db, &stores, sql, model.VendorIDEBAI, utils.DefaultTimeValue, storeID); err == nil {
|
||||
for _, store := range stores {
|
||||
params := genStoreMapFromStore(store)
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(params, false))
|
||||
if globals.EnableStoreWrite && globals.EnableEbaiStoreWrite {
|
||||
if err = api.EbaiAPI.ShopUpdate(params); err == nil {
|
||||
shopID := 0
|
||||
if store.SyncStatus&model.SyncFlagDeletedMask == 0 {
|
||||
shopID = store.ID
|
||||
shopID := 0
|
||||
if store.SyncStatus&model.SyncFlagDeletedMask == 0 {
|
||||
shopID = store.ID
|
||||
}
|
||||
store2, err2 := p.ReadStore(store.VendorStoreID)
|
||||
if err = err2; err == nil {
|
||||
if store2.ID == store.ID {
|
||||
shopID = -1
|
||||
}
|
||||
store2, err2 := p.ReadStore(store.VendorStoreID)
|
||||
if err = err2; err == nil {
|
||||
if store2.ID == store.ID {
|
||||
shopID = -1
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
if shopID > 0 {
|
||||
err = api.EbaiAPI.ShopIDBatchUpdate([]string{store.VendorStoreID}, []string{utils.Int2Str(shopID)})
|
||||
} else if shopID == 0 {
|
||||
// todo remove out shop id
|
||||
}
|
||||
if err == nil {
|
||||
if shopID > 0 {
|
||||
err = api.EbaiAPI.ShopIDBatchUpdate([]string{store.VendorStoreID}, []string{utils.Int2Str(shopID)})
|
||||
} else if shopID == 0 {
|
||||
// todo remove out shop id
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
mergeStatus := jxutils.MergeStoreStatus(store.Status, store.EbaiStoreStatus)
|
||||
if mergeStatus == model.StoreStatusOpened {
|
||||
err = api.EbaiAPI.ShopOnline("", utils.Str2Int64(store.VendorStoreID))
|
||||
} else if mergeStatus == model.StoreStatusClosed {
|
||||
err = api.EbaiAPI.ShopOffline("", utils.Str2Int64(store.VendorStoreID))
|
||||
} else if mergeStatus == model.StoreStatusClosed {
|
||||
err = api.EbaiAPI.ShopClose("", utils.Str2Int64(store.VendorStoreID))
|
||||
}
|
||||
if err == nil {
|
||||
mergeStatus := jxutils.MergeStoreStatus(store.Status, store.EbaiStoreStatus)
|
||||
if mergeStatus == model.StoreStatusOpened {
|
||||
err = api.EbaiAPI.ShopOnline("", utils.Str2Int64(store.VendorStoreID))
|
||||
} else if mergeStatus == model.StoreStatusClosed {
|
||||
err = api.EbaiAPI.ShopOffline("", utils.Str2Int64(store.VendorStoreID))
|
||||
} else if mergeStatus == model.StoreStatusClosed {
|
||||
err = api.EbaiAPI.ShopClose("", utils.Str2Int64(store.VendorStoreID))
|
||||
}
|
||||
if err != nil {
|
||||
// todo
|
||||
if intErr, ok := err.(*utils.ErrorWithCode); ok {
|
||||
if intErr.IntCode() == 201101 {
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
// todo
|
||||
if intErr, ok := err.(*utils.ErrorWithCode); ok {
|
||||
if intErr.IntCode() == 201101 {
|
||||
err = nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
params := genStoreMapFromStore(store)
|
||||
if err = api.EbaiAPI.ShopUpdate(params); err == nil {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user