+ partner.ListOrders

+ AmendMissingOrders
This commit is contained in:
gazebo
2019-07-18 18:46:14 +08:00
parent 9db41bb15a
commit d5752381c7
10 changed files with 309 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package jd
import (
"fmt"
"strings"
"time"
@@ -411,3 +412,27 @@ func (c *PurchaseHandler) AdjustOrder(ctx *jxcontext.Context, order *model.Goods
}
return err
}
func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, parentTask tasksch.ITask, queryDate time.Time, vendorStoreID string) (vendorOrderIDs []string, err error) {
if utils.IsTimeZero(queryDate) {
return nil, fmt.Errorf("queryDate必须指定")
}
fromDate := utils.Time2Date(queryDate)
toDate := fromDate.Add(24*time.Hour - 1)
params := map[string]interface{}{
"orderPurchaseTime_begin": utils.Time2Str(fromDate),
"orderPurchaseTime_end": utils.Time2Str(toDate),
jdapi.KeyPageNo: jdapi.AllPage,
}
if vendorStoreID != "" {
params["deliveryStationNo"] = vendorStoreID
}
orderList, _, err := api.JdAPI.OrderQuery2(params)
if err == nil {
vendorOrderIDs = make([]string, len(orderList))
for k, v := range orderList {
vendorOrderIDs[k] = utils.Int64ToStr(v.OrderID)
}
}
return vendorOrderIDs, err
}