From d2ff7cde17e34e3e487a1e2c32c1a4e5d4659fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 11 Aug 2020 09:17:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95=E9=85=8D?= =?UTF-8?q?=E9=80=81=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 20 ++++++++++++++++++++ controllers/jx_order.go | 15 +++++++++++++++ controllers/jx_order2.go | 2 ++ routers/commentsRouter_controllers.go | 9 +++++++++ 4 files changed, 46 insertions(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 865209fc4..ebc45ba75 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1490,3 +1490,23 @@ func AdjustJdsOrderSimple(ctx *jxcontext.Context, vendorOrderID string, skuID in } return err } + +func UpdateWaybillDesiredFee(ctx *jxcontext.Context, vendorOrderID string, desiredFee int) (err error) { + var ( + db = dao.GetDB() + ) + order, _ := dao.GetSimpleOrder(db, vendorOrderID) + if order == nil { + return fmt.Errorf("未找到该订单!orderID: %v", vendorOrderID) + } + bill, err := partner.CurOrderManager.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID) + if err != nil { + return err + } + if bill == nil { + return fmt.Errorf("未找到此订单对应的运单!orderID: %v", vendorOrderID) + } + bill.DesiredFee = int64(desiredFee) + _, err = dao.UpdateEntity(db, bill, "DesiredFee") + return err +} diff --git a/controllers/jx_order.go b/controllers/jx_order.go index 0839dcc9a..63b872ad7 100644 --- a/controllers/jx_order.go +++ b/controllers/jx_order.go @@ -1119,3 +1119,18 @@ func (c *OrderController) AdjustJdsOrderSimple() { return retVal, "", err }) } + +// @Title 修改订单运费 +// @Description 修改订单运费 +// @Param token header string true "认证token" +// @Param vendorOrderID formData string true "订单号" +// @Param desiredFee formData int true "运费" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /UpdateWaybillDesiredFee [put] +func (c *OrderController) UpdateWaybillDesiredFee() { + c.callUpdateWaybillDesiredFee(func(params *tOrderUpdateWaybillDesiredFeeParams) (retVal interface{}, errCode string, err error) { + err = orderman.UpdateWaybillDesiredFee(params.Ctx, params.VendorOrderID, params.DesiredFee) + return retVal, "", err + }) +} diff --git a/controllers/jx_order2.go b/controllers/jx_order2.go index 707c210c9..b355610cb 100644 --- a/controllers/jx_order2.go +++ b/controllers/jx_order2.go @@ -222,3 +222,5 @@ func (c *JxOrderController) SendFailedMatterOrder() { return retVal, "", err }) } + + diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index 7a51db86e..22f502d75 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -1314,6 +1314,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"], + beego.ControllerComments{ + Method: "UpdateWaybillDesiredFee", + Router: `/UpdateWaybillDesiredFee`, + AllowHTTPMethods: []string{"put"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ReportController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ReportController"], beego.ControllerComments{ Method: "AutoFocusStoreSkus",