+ UpdateWaybillTip

This commit is contained in:
gazebo
2019-07-30 14:43:28 +08:00
parent 15c6607eb2
commit e7bad7dc25
3 changed files with 31 additions and 6 deletions

View File

@@ -425,15 +425,15 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, parentTask tasksch.
}
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,
queryParam := &jdapi.OrderQueryParam{
OrderPurchaseTimeBegin: utils.Time2Str(fromDate),
OrderPurchaseTimeEnd: utils.Time2Str(toDate),
PageNo: jdapi.AllPage,
}
if vendorStoreID != "" {
params["deliveryStationNo"] = vendorStoreID
queryParam.DeliveryStationNo = vendorStoreID
}
orderList, _, err := api.JdAPI.OrderQuery2(params)
orderList, _, err := api.JdAPI.OrderQuery2(queryParam)
if err == nil {
vendorOrderIDs = make([]string, len(orderList))
for k, v := range orderList {
@@ -442,3 +442,16 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, parentTask tasksch.
}
return vendorOrderIDs, err
}
func (c *PurchaseHandler) UpdateWaybillTip(ctx *jxcontext.Context, order *model.GoodsOrder, tipFee int64) (err error) {
orderInfo, err := api.JdAPI.QuerySingleOrder2(order.VendorOrderID)
if err == nil {
tip2Add := int(tipFee) - orderInfo.Tips
if tip2Add > 0 {
if globals.EnableJdStoreWrite {
err = api.JdAPI.OrderAddTips(order.VendorOrderID, tip2Add, ctx.GetUserName())
}
}
}
return err
}