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 }