+ GetAllStoresVendorID

This commit is contained in:
gazebo
2019-07-22 15:38:01 +08:00
parent a4470e5fb5
commit 8406359a7c
6 changed files with 31 additions and 17 deletions

View File

@@ -572,28 +572,24 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, parentTask tasksch.
}
fromDate := utils.Time2Date(queryDate)
toDate := fromDate.Add(24*time.Hour - 1)
var shopList []*ebaiapi.ShopInfo
var vendorStoreIDs []string
if vendorStoreID == "" {
shopList, err = api.EbaiAPI.ShopList(ebaiapi.SysStatusAll)
vendorStoreIDs, err = c.GetAllStoresVendorID(ctx)
if err != nil {
return nil, err
}
} else {
shopList = []*ebaiapi.ShopInfo{
&ebaiapi.ShopInfo{
BaiduShopID: utils.Str2Int64(vendorStoreID),
},
}
vendorStoreIDs = []string{vendorStoreID}
}
task := tasksch.NewParallelTask("ebai ListOrders", nil, ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
shop := batchItemList[0].(*ebaiapi.ShopInfo)
orderList, err := api.EbaiAPI.OrderListAll("", shop.BaiduShopID, fromDate.Unix(), toDate.Unix(), 0)
vendorStoreID := batchItemList[0].(string)
orderList, err := api.EbaiAPI.OrderListAll("", utils.Str2Int64(vendorStoreID), fromDate.Unix(), toDate.Unix(), 0)
if err == nil {
retVal = orderList
}
return retVal, err
}, shopList)
}, vendorStoreIDs)
tasksch.HandleTask(task, parentTask, true).Run()
orderList, err := task.GetResult(0)
if err == nil && len(orderList) > 0 {

View File

@@ -465,3 +465,14 @@ func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, storeID int,
}
return err
}
func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context) (vendorStoreIDs []string, err error) {
shopList, err := api.EbaiAPI.ShopList(ebaiapi.SysStatusAll)
if err == nil && len(shopList) > 0 {
vendorStoreIDs = make([]string, len(shopList))
for k, v := range shopList {
vendorStoreIDs[k] = utils.Int64ToStr(v.BaiduShopID)
}
}
return vendorStoreIDs, err
}