- 接收门店状态消息,本地同步状态,京东暂时无效
This commit is contained in:
@@ -98,7 +98,7 @@ func (p *PurchaseHandler) ReadStore(vendorStoreID string) (*model.Store, error)
|
||||
}
|
||||
}
|
||||
|
||||
if ebaiStatus, err2 := api.EbaiAPI.ShopBusStatusGet("", baiduShopID, ebaiapi.PlatformFlagBaidu); err2 == nil {
|
||||
if ebaiStatus, err2 := api.EbaiAPI.ShopBusStatusGet("", baiduShopID, ebaiapi.PlatformFlagElm); err2 == nil {
|
||||
retVal.Status = EbaiBusStatus2JxStatus(ebaiStatus)
|
||||
}
|
||||
|
||||
@@ -394,3 +394,31 @@ func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} {
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, vendorStoreID string) (storeStatus int, err error) {
|
||||
ebaiStatus, err := api.EbaiAPI.ShopBusStatusGet("", utils.Str2Int64(vendorStoreID), ebaiapi.PlatformFlagElm)
|
||||
if err == nil {
|
||||
storeStatus = EbaiBusStatus2JxStatus(ebaiStatus)
|
||||
}
|
||||
return storeStatus, err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) onShopMsgPush(msg *ebaiapi.CallbackMsg) (response *ebaiapi.CallbackResponse) {
|
||||
var err error
|
||||
vendorStoreID := utils.Interface2String(msg.Body["baidu_shop_id"])
|
||||
storeStatus := model.StoreStatusOpened
|
||||
switch utils.Interface2String(msg.Body["msg_type"]) {
|
||||
case "online", "offline":
|
||||
storeStatus, err = c.GetStoreStatus(jxcontext.AdminCtx, vendorStoreID)
|
||||
case "shop_open":
|
||||
if utils.Interface2String(msg.Body["business_ele"]) == "1" {
|
||||
storeStatus = model.StoreStatusOpened
|
||||
} else {
|
||||
storeStatus = model.StoreStatusClosed
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
err = partner.CurStoreManager.OnStoreStatusChanged(vendorStoreID, model.VendorIDEBAI, storeStatus)
|
||||
}
|
||||
return api.EbaiAPI.Err2CallbackResponse(msg.Cmd, err, nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user