京东商城订单补全

This commit is contained in:
苏尹岚
2020-06-01 11:59:33 +08:00
parent baf505b677
commit 2e975d1ba8
2 changed files with 35 additions and 2 deletions

View File

@@ -97,6 +97,29 @@ func (p *PurchaseHandler) ConfirmReceivedReturnGoods(ctx *jxcontext.Context, ord
return err
}
func GetJdsOrder(ctx *jxcontext.Context, vendorOrderID string) {
func (p *PurchaseHandler) GetJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd string) (orders []*model.GoodsOrder, err error) {
orderResult, err := api.JdShopAPI.AllOrders(&jdshopapi.AllOrdersParam{
Current: 1,
PageSize: 10,
OrderCreateDateRange: []string{orderCreatedStart, orderCreatedEnd},
})
orders, err = result2Orders(orderResult)
return orders, err
}
func result2Orders(result *jdshopapi.AllOrdersResult) (orders []*model.GoodsOrder, err error) {
for _, jdsOrder := range result.OrderList {
order := &model.GoodsOrder{
VendorOrderID: utils.Int64ToStr(jdsOrder.OrderID),
VendorID: model.VendorIDJDShop,
BaseFreightMoney: jxutils.StandardPrice2Int(jdsOrder.Freight),
VendorStatus: utils.Int2Str(jdsOrder.OrderStatus),
VendorUserID: jdsOrder.UserPin,
BuyerComment: jdsOrder.UserRemark,
// PickDeadline: utils.DefaultTimeValue,
OriginalData: string(utils.MustMarshal(jdsOrder)),
}
orders = append(orders, order)
}
return orders, err
}