京东商城订单补全
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user