+ OpenRemoteStoreByJxStatus
This commit is contained in:
@@ -181,27 +181,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
}
|
||||
if err == nil {
|
||||
mergeStatus := jxutils.MergeStoreStatus(store.Status, store.EbaiStoreStatus)
|
||||
if !isStoreStatusSame(store2.Status, mergeStatus) {
|
||||
if mergeStatus == model.StoreStatusOpened {
|
||||
err = api.EbaiAPI.ShopOpen("", utils.Str2Int64(store.VendorStoreID))
|
||||
} else if mergeStatus == model.StoreStatusHaveRest || mergeStatus == model.StoreStatusClosed {
|
||||
err = api.EbaiAPI.ShopClose("", utils.Str2Int64(store.VendorStoreID))
|
||||
} else if mergeStatus == model.StoreStatusDisabled {
|
||||
err = api.EbaiAPI.ShopOffline("", utils.Str2Int64(store.VendorStoreID))
|
||||
}
|
||||
if intErr, ok := err.(*utils.ErrorWithCode); ok && intErr.IntCode() == 201100 {
|
||||
err = nil
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
// todo
|
||||
if intErr, ok := err.(*utils.ErrorWithCode); ok {
|
||||
if intErr.IntCode() == 201101 {
|
||||
err = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
if err = p.updateStoreStatus(userName, storeID, store.VendorStoreID, mergeStatus, store2.Status); err != nil {
|
||||
return err
|
||||
}
|
||||
params := genStoreMapFromStore(store)
|
||||
@@ -441,3 +421,29 @@ func (c *PurchaseHandler) GetShopHealthInfo(vendorShopID string) (shopHealthInfo
|
||||
}
|
||||
return shopHealthInfo, err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) UpdateStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string, status int) (err error) {
|
||||
store, err := c.ReadStore(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.ShopOffline("", utils.Str2Int64(vendorStoreID))
|
||||
}
|
||||
}
|
||||
if intErr, ok := err.(*utils.ErrorWithCode); ok && intErr.IntCode() == 201100 {
|
||||
err = nil
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user