From f51dbcd50a7ccf03ca442ebbbc42f2ae4a712198 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 2 Feb 2023 17:20:16 +0800 Subject: [PATCH] 1 --- business/partner/delivery/uupt/waybill.go | 49 ++++++++++++------- .../partner/purchase/tiktok_store/waybill.go | 4 +- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/business/partner/delivery/uupt/waybill.go b/business/partner/delivery/uupt/waybill.go index 6e83c56da..77cb40759 100644 --- a/business/partner/delivery/uupt/waybill.go +++ b/business/partner/delivery/uupt/waybill.go @@ -137,6 +137,11 @@ func (d DeliveryHandler) IsErrStoreExist(err error) bool { } func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee int64) (bill *model.Waybill, err error) { + //获取门店老板详情 + storeOwner, err := dao.GetStoreDetail(dao.GetDB(), getReallyStoreID(order.StoreID, order.JxStoreID), 0, "") + if err != nil { + return nil, err + } //获取金额令牌,实际需要支付金额 price, err := getOrderPrice(order) if err != nil { @@ -148,8 +153,10 @@ func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee i "balance_paymoney": price.NeedPayMoney, "receiver": order.ConsigneeName, "receiver_phone": order.ConsigneeMobile, + "note": utils.FilterMb4("客户电话:" + order.ConsigneeMobile + "," + order.BuyerComment + ",配送遇到问题,可联系18048531223取消配送单,禁止未配送直接完成定单!"), "callback_url": uuptapi.WaybillCallbackURL, "push_type": uuptapi.PushTypeOpen, + "pubusermobile": storeOwner.Tel1, //老板电话 "special_type": uuptapi.SpecialTypeNo, "callme_withtake": uuptapi.CallMeWithTakeYes, } @@ -249,15 +256,16 @@ func getOrderPrice(order *model.GoodsOrder) (orderPrice *uuptapi.GetOrderPriceRe }) coords, err = api.BaiDuNaviAPI.BatchCoordinateConvert(coords, baidunavi.CoordSysGCJ02, baidunavi.CoordSysBaiDu) param := map[string]interface{}{ - "origin_id": order.VendorOrderID, - "from_address": store.Address, - "to_address": order.ConsigneeAddress, - "city_name": store.CityName, - "send_type": uuptapi.SendTypeHelpMeDeliver, - "from_lat": coords[0].Lat, - "from_lng": coords[0].Lng, - "to_lat": coords[1].Lat, - "to_lng": coords[1].Lng, + "origin_id": order.VendorOrderID, + "from_address": store.Address, + "from_usernote": "京西菜市(" + store.Store.Name + ")", + "to_address": order.ConsigneeAddress, + "city_name": store.CityName, + "send_type": uuptapi.SendTypeHelpMeDeliver, + "from_lat": coords[0].Lat, + "from_lng": coords[0].Lng, + "to_lat": coords[1].Lat, + "to_lng": coords[1].Lng, } if orderPrice, err = api.UuAPI.GetOrderPrice(param); err != nil { return nil, err @@ -265,16 +273,7 @@ func getOrderPrice(order *model.GoodsOrder) (orderPrice *uuptapi.GetOrderPriceRe return orderPrice, nil } } -func getReallyStoreID(storeID, jxStoreID int) int { - if storeID == 0 && jxStoreID == 0 { - return 0 - } - if storeID == 0 { - return jxStoreID - } else { - return storeID - } -} + func OnWaybillMsg(req *uuptapi.WaybillCallbackParam) (resp *uuptapi.CallbackResponse) { param := &model.Waybill{ VendorOrderID: req.OriginID, @@ -318,3 +317,15 @@ func OnWaybillMsg(req *uuptapi.WaybillCallbackParam) (resp *uuptapi.CallbackResp } return uuptapi.Err2CallbackResponse(nil) } + +//辅助函数 +func getReallyStoreID(storeID, jxStoreID int) int { + if storeID == 0 && jxStoreID == 0 { + return 0 + } + if storeID == 0 { + return jxStoreID + } else { + return storeID + } +} diff --git a/business/partner/purchase/tiktok_store/waybill.go b/business/partner/purchase/tiktok_store/waybill.go index 8ab4863d6..c115b4fb7 100644 --- a/business/partner/purchase/tiktok_store/waybill.go +++ b/business/partner/purchase/tiktok_store/waybill.go @@ -23,8 +23,8 @@ var ( tiktok_api.ShipmentStatusRejected: model.WaybillStatusRejected, tiktok_api.ShipmentStatusReturning: model.WaybillStatusReturning, tiktok_api.ShipmentStatusReturned: model.WaybillStatusReturned, - tiktok_api.ShipmentStatusDelivered: model.WaybillStatusCanceled, - tiktok_api.ShipmentStatusCanceled: model.WaybillStatusDelivered, + tiktok_api.ShipmentStatusDelivered: model.WaybillStatusDelivered, + tiktok_api.ShipmentStatusCanceled: model.WaybillStatusCanceled, } )