From 2e975d1ba867d6a24317eea0ab9ee4d46c441537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 1 Jun 2020 11:59:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 10 +++++++++ business/partner/purchase/jdshop/order.go | 27 +++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 93a9c6705..0ecff74d2 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -7,6 +7,8 @@ import ( "strings" "time" + "git.rosy.net.cn/jx-callback/business/partner/purchase/jdshop" + "git.rosy.net.cn/jx-callback/business/jxutils/tasksch" "git.rosy.net.cn/baseapi" @@ -995,3 +997,11 @@ func GetOrderSimpleInfo(ctx *jxcontext.Context, vendorOrderID string) (getOrderS return getOrderSimpleInfoResult, err } + +func SaveJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd time.Time) (err error) { + orders, err := jdshop.CurPurchaseHandler.GetJdsOrders(ctx, utils.Time2Str(orderCreatedStart), utils.Time2Str(orderCreatedEnd)) + for _, _ = range orders { + + } + return err +} diff --git a/business/partner/purchase/jdshop/order.go b/business/partner/purchase/jdshop/order.go index f4f932caf..33772f9fd 100644 --- a/business/partner/purchase/jdshop/order.go +++ b/business/partner/purchase/jdshop/order.go @@ -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 }