+ partner.ListOrders
+ AmendMissingOrders
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@ package jd
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
|
||||
_ "git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
@@ -17,8 +21,7 @@ func TestSwitch2SelfDeliver(t *testing.T) {
|
||||
orderID := "817540316000041"
|
||||
if order, err := partner.CurOrderManager.LoadOrder(orderID, model.VendorIDJD); err == nil {
|
||||
// globals.SugarLogger.Debug(order)
|
||||
c := new(PurchaseHandler)
|
||||
if err = c.Swtich2SelfDeliver(order, ""); err == nil {
|
||||
if err = curPurchaseHandler.Swtich2SelfDeliver(order, ""); err == nil {
|
||||
} else {
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
@@ -28,8 +31,16 @@ func TestSwitch2SelfDeliver(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOrder(t *testing.T) {
|
||||
_, err := new(PurchaseHandler).GetOrder("815536199000222")
|
||||
_, err := curPurchaseHandler.GetOrder("815536199000222")
|
||||
if err != nil {
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func TestListOrders(t *testing.T) {
|
||||
result, err := curPurchaseHandler.ListOrders(jxcontext.AdminCtx, nil, time.Now(), "")
|
||||
if err != nil {
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user