修复饿百在设置门店状态后以上取状态状态没有变化导致的bug
This commit is contained in:
@@ -100,9 +100,7 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendo
|
||||
retVal.DeliveryType = EbaiDeliveryType2Jx(utils.Interface2String(result["delivery_type"]))
|
||||
|
||||
retVal.SetOpTime(ebaiOpTime2Jx(result["business_time"]))
|
||||
if ebaiStatus, err2 := api.EbaiAPI.ShopBusStatusGet("", baiduShopID, ebaiapi.PlatformFlagElm); err2 == nil {
|
||||
retVal.Status = EbaiBusStatus2JxStatus(ebaiStatus)
|
||||
}
|
||||
retVal.Status, _ = p.GetStoreStatus(ctx, vendorOrgCode, 0, vendorStoreID)
|
||||
|
||||
tel2 := utils.Interface2String(result["ivr_phone"])
|
||||
if tel2 != "" && tel2 != retVal.Tel1 {
|
||||
@@ -188,7 +186,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
if err == nil {
|
||||
if store.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
|
||||
mergeStatus := jxutils.MergeStoreStatus(store.Status, store.EbaiStoreStatus)
|
||||
if err = p.updateStoreStatus(userName, storeID, store.VendorStoreID, mergeStatus, store2.Status); err != nil {
|
||||
if err = p.UpdateStoreStatus(jxcontext.AdminCtx, store.VendorOrgCode, storeID, store.VendorStoreID, mergeStatus); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -468,27 +466,21 @@ func (p *PurchaseHandler) EnableAutoAcceptOrder(ctx *jxcontext.Context, vendorOr
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) UpdateStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, status int) (err error) {
|
||||
store, err := c.ReadStore(ctx, vendorOrgCode, vendorStoreID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return c.updateStoreStatus(ctx.GetUserName(), storeID, vendorStoreID, status, store.Status)
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) updateStoreStatus(userName string, storeID int, vendorStoreID string, status, currentStatus int) (err error) {
|
||||
if !isStoreStatusSame(currentStatus, status) {
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
if status == model.StoreStatusOpened {
|
||||
err = api.EbaiAPI.ShopOpen("", utils.Str2Int64(vendorStoreID))
|
||||
} else if status == model.StoreStatusHaveRest || status == model.StoreStatusClosed {
|
||||
err = api.EbaiAPI.ShopClose("", utils.Str2Int64(vendorStoreID))
|
||||
} else if status == model.StoreStatusDisabled {
|
||||
err = api.EbaiAPI.ShopClose("", utils.Str2Int64(vendorStoreID))
|
||||
// err = api.EbaiAPI.ShopOffline("", utils.Str2Int64(vendorStoreID))
|
||||
}
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
if status == model.StoreStatusOpened {
|
||||
err = api.EbaiAPI.ShopOpen("", utils.Str2Int64(vendorStoreID))
|
||||
} else if status == model.StoreStatusHaveRest || status == model.StoreStatusClosed {
|
||||
err = api.EbaiAPI.ShopClose("", utils.Str2Int64(vendorStoreID))
|
||||
} else if status == model.StoreStatusDisabled {
|
||||
err = api.EbaiAPI.ShopClose("", utils.Str2Int64(vendorStoreID))
|
||||
// err = api.EbaiAPI.ShopOffline("", utils.Str2Int64(vendorStoreID))
|
||||
}
|
||||
if intErr, ok := err.(*utils.ErrorWithCode); ok && intErr.IntCode() == 201100 {
|
||||
err = nil
|
||||
if err != nil {
|
||||
if remoteStatus, err2 := c.GetStoreStatus(ctx, vendorOrgCode, storeID, vendorStoreID); err2 == nil && remoteStatus == status {
|
||||
err = nil
|
||||
} else if intErr, ok := err.(*utils.ErrorWithCode); ok && intErr.IntCode() == 201100 {
|
||||
err = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user