From c81346d0f70f2ef7d9f77606b6942ae00b1bd366 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Tue, 31 Jan 2023 14:38:28 +0800 Subject: [PATCH] 1 --- .../jxcallback/scheduler/defsch/defsch_ext.go | 2 +- .../partner/delivery/tiktok_store/waybill.go | 479 +++++++++--------- 2 files changed, 241 insertions(+), 240 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch_ext.go b/business/jxcallback/scheduler/defsch/defsch_ext.go index 7fb14fd97..789bfd9c7 100644 --- a/business/jxcallback/scheduler/defsch/defsch_ext.go +++ b/business/jxcallback/scheduler/defsch/defsch_ext.go @@ -45,7 +45,7 @@ func (s *DefScheduler) SelfDeliveringAndUpdateStatus(ctx *jxcontext.Context, ven err = s.SelfDeliverDelivering(order, phone) } } else { - if order.Status < model.OrderStatusDelivering || (order.VendorID == model.VendorIDDD && order.Status <= model.OrderStatusDelivering) { + if order.Status < model.OrderStatusDelivering || (order.VendorID == model.VendorIDDD && order.Status < model.OrderStatusDelivering) { err = s.Swtich2SelfDeliver(order, userName) } else if order.VendorID == order.WaybillVendorID { // 状态为配送中,且是购物平台运单,不能转自送了 err = scheduler.ErrOrderStatusIsNotSuitable4CurOperation diff --git a/business/partner/delivery/tiktok_store/waybill.go b/business/partner/delivery/tiktok_store/waybill.go index 3e1f2bd8e..79cb04c2f 100644 --- a/business/partner/delivery/tiktok_store/waybill.go +++ b/business/partner/delivery/tiktok_store/waybill.go @@ -1,241 +1,242 @@ package tiktok_store -import ( - "errors" - "git.rosy.net.cn/baseapi/platformapi/mtpsapi" - shop_getStoreDetail_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_getStoreDetail/request" - superm_createVirtualMobile_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_createVirtualMobile/response" - "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api" - "git.rosy.net.cn/baseapi/utils" - "git.rosy.net.cn/jx-callback/business/jxutils" - "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" - "git.rosy.net.cn/jx-callback/business/model" - "git.rosy.net.cn/jx-callback/business/model/dao" - "git.rosy.net.cn/jx-callback/business/partner" - "git.rosy.net.cn/jx-callback/globals" - "git.rosy.net.cn/jx-callback/globals/api" - "time" -) - -var ( - curDeliveryHandler *DeliveryHandler -) - -type DeliveryHandler struct { -} - -func init() { - if api.TiktokStore != nil { - curDeliveryHandler = new(DeliveryHandler) - partner.RegisterDeliveryPlatform(curDeliveryHandler, true) - } -} - -func (c *DeliveryHandler) GetVendorID() int { - return model.VendorIDDYPS -} - -func (c *DeliveryHandler) CreateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (vendorStoreID string, status int, err error) { - return "", 0, errors.New("抖店暂不支持此操作") -} - -func (c *DeliveryHandler) GetStore(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeDetail *dao.StoreDetail2, err error) { - relInfo, err := dao.GetStoreDetailForDD(dao.GetDB(), storeID, model.VendorIDDD, vendorStoreID, "") - if err != nil { - return nil, errors.New("获取抖音平台账号信息失败,请重试") - } - apiObj := getAPI(relInfo.VendorOrgCode) - if storeInfo, err := apiObj.GetStoreDetail(&shop_getStoreDetail_request.ShopGetStoreDetailParam{ - StoreId: vendorStoreID, - }); err == nil { - storeDetail = &dao.StoreDetail2{ - Store: model.Store{ - Name: storeInfo.StoreDetail.Store.Name, - Tel1: storeInfo.StoreDetail.Store.Contact, - Address: storeInfo.StoreDetail.Store.Address, - Lng: jxutils.StandardCoordinate2Int(utils.Str2Float64(storeInfo.StoreDetail.Store.Longitude)), - Lat: jxutils.StandardCoordinate2Int(utils.Str2Float64(storeInfo.StoreDetail.Store.Latitude)), - }, - VendorID: model.VendorIDDYPS, - VendorStoreID: utils.Int64ToStr(storeInfo.StoreDetail.Store.StoreId), - CourierStatus: int(storeInfo.StoreDetail.Store.State), - } - } else { - globals.SugarLogger.Debugf("GetStoreDetail err %s", err) - } - return storeDetail, err -} - -func (c *DeliveryHandler) IsErrStoreNotExist(err error) bool { - return false -} - -func (c *DeliveryHandler) IsErrStoreExist(err error) bool { - return false -} - -// 呼叫运力并发货 -func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee int64) (bill *model.Waybill, err error) { - return nil, nil - //relInfo, err := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, model.VendorIDDD, "") - //if err != nil { - // return nil, errors.New("获取抖音平台账号信息失败,请重试") - //} - //apiObj := getAPI(relInfo.VendorOrgCode) - //if order.VendorID != model.VendorIDDD { - // return nil, errors.New("非抖音平台店铺不可发抖音配送") - //} - //bill = &model.Waybill{ - // VendorOrderID: order.VendorOrderID, - // OrderVendorID: order.VendorID, - // VendorWaybillID: order.VendorOrderID, //抖音配送订单号即运单号 - // WaybillVendorID: model.VendorIDDYPS, - //} - //if dispatcherFee, err := apiObj.GetDispatcherInfo(int64(order.StoreID), order.VendorOrderID, tiktok_api.DispatcherFeeTypeCall); err == nil { - // bill.DesiredFee = dispatcherFee - //} - //if err := apiObj.ShopOrderDispatcher(utils.Str2Int64(order.VendorStoreID), order.VendorOrderID, tiktok_api.DispatcherFeeTypeCall); err != nil { - // return nil, err - //} - //delivery.OnWaybillCreated(bill) - //return bill, nil -} - -func (c *DeliveryHandler) CancelWaybill(bill *model.Waybill, cancelReasonID int, cancelReason string) (err error) { - return nil - //params := make(map[string]interface{}, 0) - //params["vendorOrderID"] = bill.VendorOrderID - //if localOrder, _, err := dao.GetOrders(dao.GetDB(), nil, false, false, "", "", false, []int{0}, false, "", params, 0, 0); err != nil { - // return errors.New("取消运单时,获取平台门店ID失败,请重试") - //} else { - // if err = getAPI(bill.VendorOrgCode).ShopOrderDispatcher(utils.Str2Int64(localOrder[0].VendorStoreID), bill.VendorOrderID, tiktok_api.DispatcherFeeTypeCancel); err != nil { - // return fmt.Errorf("抖音配送取消运力失败:%v", err) - // } - // bill.Status = model.WaybillStatusCanceled - // bill.Remark = cancelReason - // partner.CurOrderManager.OnWaybillStatusChanged(bill) - //} - //return err -} - -func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInfo *partner.WaybillFeeInfo, err error) { - return nil, nil - //relInfo, err := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, model.VendorIDDD, "") - //if err != nil { - // return nil, errors.New("获取抖音平台账号信息失败,请重试") - //} - //if dispatcherFee, err := getAPI(relInfo.VendorOrgCode).GetDispatcherInfo(utils.Str2Int64(relInfo.VendorStoreID), order.VendorOrderID, tiktok_api.DispatcherFeeTypeCall); err == nil { - // deliveryFeeInfo = &partner.WaybillFeeInfo{} - // deliveryFeeInfo.DeliveryFee = dispatcherFee - //} - //return deliveryFeeInfo, err -} -func getDispatcherFee(storeID int64, vendorOrderID string, dispatcherType int32) int64 { - if relInfo, err := dao.GetStoreDetailForDD(dao.GetDB(), 0, model.VendorIDDD, utils.Int64ToStr(storeID), ""); err != nil { - return 0 - } else { - if dispatcherFee, err := getAPI(relInfo.VendorOrgCode).GetDispatcherInfo(storeID, vendorOrderID, dispatcherType); err == nil { - return 0 - } else { - return dispatcherFee - } - } -} -func (c *DeliveryHandler) ComplaintRider(bill *model.Waybill, resonID int, resonContent string) (err error) { - return errors.New("抖店配送暂不支持此操作") -} - -func (c *DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeisongId string) (rider *mtpsapi.RiderInfo, err error) { - orderInfo, _, err := dao.GetOrders(dao.GetDB(), []int64{utils.Str2Int64(orderId)}, false, false, "", "", false, []int{0}, false, "", nil, 0, 0) - if err != nil { - return nil, errors.New("获取本地门店账号信息失败,请重试") - } - if waybill, err := getAPI(orderInfo[0].VendorOrgCode).GetShipmentInfo(utils.Str2Int64(orderId), deliveryId, tiktok_api.ShipmentTypeInvoice); err != nil { - return nil, err - } else { - rider = &mtpsapi.RiderInfo{ - OrderId: orderId, - ThirdCarrierOrderId: mtPeisongId, - CourierName: waybill.RiderName, - CourierPhone: waybill.RiderPhone, - LogisticsProviderCode: mtpsapi.DYPsCode, - LogisticsStatus: int(waybill.ShipmentStatus), - LogisticsContext: tiktok_api.ShipmentStatus[waybill.ShipmentStatus], - Latitude: waybill.RiderLatitude, - Longitude: waybill.RiderLongitude, - } - } - globals.SugarLogger.Debugf("DYPS GetRiderInfo rider======%s", utils.Format4Output(rider, false)) - return rider, nil -} - -func CreateVirtualMobile(shopOrderID int64) (*superm_createVirtualMobile_response.SupermCreateVirtualMobileData, error) { - if orderInfo, _, err := dao.GetOrders(dao.GetDB(), []int64{shopOrderID}, false, false, "", "", false, []int{0}, false, "", nil, 0, 0); err != nil { - return nil, errors.New("获取本地门店账号信息失败,请重试") - } else { - if visMobile, err := getAPI(orderInfo[0].VendorOrgCode).CreateVirtualMobile(shopOrderID); err != nil { - return nil, err - } else { - return visMobile, nil - } - } -} - -//订单状态回调 -func OnWaybillMsg(tag, orderId string, data interface{}) (response *tiktok_api.CallbackResponse) { - req := data.(tiktok_api.ShipmentInfoData) - param := &model.Waybill{ - VendorOrderID: utils.Int64ToStr(req.ShopOrderID), - VendorWaybillID: req.TrackNo, - VendorWaybillID2: utils.Int64ToStr(req.AfterSaleID), - WaybillVendorID: model.VendorIDDYPS, - OrderVendorID: model.VendorIDDD, - CourierName: req.RiderName, - CourierMobile: req.RiderPhone, - VendorStatus: utils.Int64ToStr(req.ShipmentStatus), - StatusTime: utils.Str2Time(req.OccurredTime), - Remark: "", - } - if req.OccurredTime == "" { - param.StatusTime = time.Now() - } - dispatcherFee := getDispatcherFee(req.ShopID, utils.Int64ToStr(req.ShopOrderID), tiktok_api.DispatcherFeeTypeCall) - switch req.ShipmentStatus { - case tiktok_api.ShipmentStatusCalling: //1 骑手呼叫中 - param.DesiredFee = dispatcherFee - param.Status = model.WaybillStatusNew //5 待调度 - case tiktok_api.ShipmentStatusReceived: //2 骑手已接单 - param.DesiredFee = dispatcherFee - param.Status = model.WaybillStatusCourierAssigned - param.Remark = req.RiderName + "," + req.RiderPhone - case tiktok_api.ShipmentStatusArrived: //3 骑手已到达取货点 - param.DesiredFee = dispatcherFee - param.Status = model.WaybillStatusCourierArrived //80 到店 - param.Remark = tiktok_api.ShipmentStatus[req.ShipmentStatus] - case tiktok_api.ShipmentStatusDelivering: //4 配送中 - param.Status = model.WaybillStatusDelivering - param.Remark = tiktok_api.ShipmentStatus[req.ShipmentStatus] - case tiktok_api.ShipmentStatusRejected, tiktok_api.ShipmentStatusReturning, tiktok_api.ShipmentStatusReturned: //5 收货人已拒收,6 返回中,7 返回完成 - param.Status = model.WaybillStatusDeliverFailed - param.Remark = tiktok_api.ShipmentStatus[req.ShipmentStatus] - case tiktok_api.ShipmentStatusDelivered: // 8 订单妥投 - param.Status = model.WaybillStatusDelivered - param.Remark = tiktok_api.ShipmentStatus[req.ShipmentStatus] - case tiktok_api.ShipmentStatusCanceled: //9 订单取消 - param.Status = model.WaybillStatusCanceled - param.Remark = tiktok_api.ShipmentStatus[req.ShipmentStatus] - default: - globals.SugarLogger.Warnf("onWaybillMsg unknown shipmentStatus:%v", req.ShipmentStatus) - } - globals.SugarLogger.Debugf("DYPS onWaybillMsg param=====%s", utils.Format4Output(param, false)) - if err := partner.CurOrderManager.OnWaybillStatusChanged(param); err != nil { - return tiktok_api.CallbackResponseErr(false) - } - return tiktok_api.CallbackResponseErr(true) -} - -//以下为辅助函数 -func getAPI(appOrgCode string) (apiObj *tiktok_api.API) { - apiObj = partner.CurAPIManager.GetAPI(model.VendorIDDD, appOrgCode).(*tiktok_api.API) - return apiObj -} +// +//import ( +// "errors" +// "git.rosy.net.cn/baseapi/platformapi/mtpsapi" +// shop_getStoreDetail_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_getStoreDetail/request" +// superm_createVirtualMobile_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_createVirtualMobile/response" +// "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api" +// "git.rosy.net.cn/baseapi/utils" +// "git.rosy.net.cn/jx-callback/business/jxutils" +// "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" +// "git.rosy.net.cn/jx-callback/business/model" +// "git.rosy.net.cn/jx-callback/business/model/dao" +// "git.rosy.net.cn/jx-callback/business/partner" +// "git.rosy.net.cn/jx-callback/globals" +// "git.rosy.net.cn/jx-callback/globals/api" +// "time" +//) +// +//var ( +// curDeliveryHandler *DeliveryHandler +//) +// +//type DeliveryHandler struct { +//} +// +//func init() { +// if api.TiktokStore != nil { +// curDeliveryHandler = new(DeliveryHandler) +// partner.RegisterDeliveryPlatform(curDeliveryHandler, true) +// } +//} +// +//func (c *DeliveryHandler) GetVendorID() int { +// return model.VendorIDDYPS +//} +// +//func (c *DeliveryHandler) CreateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (vendorStoreID string, status int, err error) { +// return "", 0, errors.New("抖店暂不支持此操作") +//} +// +//func (c *DeliveryHandler) GetStore(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeDetail *dao.StoreDetail2, err error) { +// relInfo, err := dao.GetStoreDetailForDD(dao.GetDB(), storeID, model.VendorIDDD, vendorStoreID, "") +// if err != nil { +// return nil, errors.New("获取抖音平台账号信息失败,请重试") +// } +// apiObj := getAPI(relInfo.VendorOrgCode) +// if storeInfo, err := apiObj.GetStoreDetail(&shop_getStoreDetail_request.ShopGetStoreDetailParam{ +// StoreId: vendorStoreID, +// }); err == nil { +// storeDetail = &dao.StoreDetail2{ +// Store: model.Store{ +// Name: storeInfo.StoreDetail.Store.Name, +// Tel1: storeInfo.StoreDetail.Store.Contact, +// Address: storeInfo.StoreDetail.Store.Address, +// Lng: jxutils.StandardCoordinate2Int(utils.Str2Float64(storeInfo.StoreDetail.Store.Longitude)), +// Lat: jxutils.StandardCoordinate2Int(utils.Str2Float64(storeInfo.StoreDetail.Store.Latitude)), +// }, +// VendorID: model.VendorIDDYPS, +// VendorStoreID: utils.Int64ToStr(storeInfo.StoreDetail.Store.StoreId), +// CourierStatus: int(storeInfo.StoreDetail.Store.State), +// } +// } else { +// globals.SugarLogger.Debugf("GetStoreDetail err %s", err) +// } +// return storeDetail, err +//} +// +//func (c *DeliveryHandler) IsErrStoreNotExist(err error) bool { +// return false +//} +// +//func (c *DeliveryHandler) IsErrStoreExist(err error) bool { +// return false +//} +// +//// 呼叫运力并发货 +//func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee int64) (bill *model.Waybill, err error) { +// return nil, nil +// //relInfo, err := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, model.VendorIDDD, "") +// //if err != nil { +// // return nil, errors.New("获取抖音平台账号信息失败,请重试") +// //} +// //apiObj := getAPI(relInfo.VendorOrgCode) +// //if order.VendorID != model.VendorIDDD { +// // return nil, errors.New("非抖音平台店铺不可发抖音配送") +// //} +// //bill = &model.Waybill{ +// // VendorOrderID: order.VendorOrderID, +// // OrderVendorID: order.VendorID, +// // VendorWaybillID: order.VendorOrderID, //抖音配送订单号即运单号 +// // WaybillVendorID: model.VendorIDDYPS, +// //} +// //if dispatcherFee, err := apiObj.GetDispatcherInfo(int64(order.StoreID), order.VendorOrderID, tiktok_api.DispatcherFeeTypeCall); err == nil { +// // bill.DesiredFee = dispatcherFee +// //} +// //if err := apiObj.ShopOrderDispatcher(utils.Str2Int64(order.VendorStoreID), order.VendorOrderID, tiktok_api.DispatcherFeeTypeCall); err != nil { +// // return nil, err +// //} +// //delivery.OnWaybillCreated(bill) +// //return bill, nil +//} +// +//func (c *DeliveryHandler) CancelWaybill(bill *model.Waybill, cancelReasonID int, cancelReason string) (err error) { +// return nil +// //params := make(map[string]interface{}, 0) +// //params["vendorOrderID"] = bill.VendorOrderID +// //if localOrder, _, err := dao.GetOrders(dao.GetDB(), nil, false, false, "", "", false, []int{0}, false, "", params, 0, 0); err != nil { +// // return errors.New("取消运单时,获取平台门店ID失败,请重试") +// //} else { +// // if err = getAPI(bill.VendorOrgCode).ShopOrderDispatcher(utils.Str2Int64(localOrder[0].VendorStoreID), bill.VendorOrderID, tiktok_api.DispatcherFeeTypeCancel); err != nil { +// // return fmt.Errorf("抖音配送取消运力失败:%v", err) +// // } +// // bill.Status = model.WaybillStatusCanceled +// // bill.Remark = cancelReason +// // partner.CurOrderManager.OnWaybillStatusChanged(bill) +// //} +// //return err +//} +// +//func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInfo *partner.WaybillFeeInfo, err error) { +// return nil, nil +// //relInfo, err := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, model.VendorIDDD, "") +// //if err != nil { +// // return nil, errors.New("获取抖音平台账号信息失败,请重试") +// //} +// //if dispatcherFee, err := getAPI(relInfo.VendorOrgCode).GetDispatcherInfo(utils.Str2Int64(relInfo.VendorStoreID), order.VendorOrderID, tiktok_api.DispatcherFeeTypeCall); err == nil { +// // deliveryFeeInfo = &partner.WaybillFeeInfo{} +// // deliveryFeeInfo.DeliveryFee = dispatcherFee +// //} +// //return deliveryFeeInfo, err +//} +//func getDispatcherFee(storeID int64, vendorOrderID string, dispatcherType int32) int64 { +// if relInfo, err := dao.GetStoreDetailForDD(dao.GetDB(), 0, model.VendorIDDD, utils.Int64ToStr(storeID), ""); err != nil { +// return 0 +// } else { +// if dispatcherFee, err := getAPI(relInfo.VendorOrgCode).GetDispatcherInfo(storeID, vendorOrderID, dispatcherType); err == nil { +// return 0 +// } else { +// return dispatcherFee +// } +// } +//} +//func (c *DeliveryHandler) ComplaintRider(bill *model.Waybill, resonID int, resonContent string) (err error) { +// return errors.New("抖店配送暂不支持此操作") +//} +// +//func (c *DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeisongId string) (rider *mtpsapi.RiderInfo, err error) { +// orderInfo, _, err := dao.GetOrders(dao.GetDB(), []int64{utils.Str2Int64(orderId)}, false, false, "", "", false, []int{0}, false, "", nil, 0, 0) +// if err != nil { +// return nil, errors.New("获取本地门店账号信息失败,请重试") +// } +// if waybill, err := getAPI(orderInfo[0].VendorOrgCode).GetShipmentInfo(utils.Str2Int64(orderId), deliveryId, tiktok_api.ShipmentTypeInvoice); err != nil { +// return nil, err +// } else { +// rider = &mtpsapi.RiderInfo{ +// OrderId: orderId, +// ThirdCarrierOrderId: mtPeisongId, +// CourierName: waybill.RiderName, +// CourierPhone: waybill.RiderPhone, +// LogisticsProviderCode: mtpsapi.DYPsCode, +// LogisticsStatus: int(waybill.ShipmentStatus), +// LogisticsContext: tiktok_api.ShipmentStatus[waybill.ShipmentStatus], +// Latitude: waybill.RiderLatitude, +// Longitude: waybill.RiderLongitude, +// } +// } +// globals.SugarLogger.Debugf("DYPS GetRiderInfo rider======%s", utils.Format4Output(rider, false)) +// return rider, nil +//} +// +//func CreateVirtualMobile(shopOrderID int64) (*superm_createVirtualMobile_response.SupermCreateVirtualMobileData, error) { +// if orderInfo, _, err := dao.GetOrders(dao.GetDB(), []int64{shopOrderID}, false, false, "", "", false, []int{0}, false, "", nil, 0, 0); err != nil { +// return nil, errors.New("获取本地门店账号信息失败,请重试") +// } else { +// if visMobile, err := getAPI(orderInfo[0].VendorOrgCode).CreateVirtualMobile(shopOrderID); err != nil { +// return nil, err +// } else { +// return visMobile, nil +// } +// } +//} +// +////订单状态回调 +//func OnWaybillMsg(tag, orderId string, data interface{}) (response *tiktok_api.CallbackResponse) { +// req := data.(tiktok_api.ShipmentInfoData) +// param := &model.Waybill{ +// VendorOrderID: utils.Int64ToStr(req.ShopOrderID), +// VendorWaybillID: req.TrackNo, +// VendorWaybillID2: utils.Int64ToStr(req.AfterSaleID), +// WaybillVendorID: model.VendorIDDYPS, +// OrderVendorID: model.VendorIDDD, +// CourierName: req.RiderName, +// CourierMobile: req.RiderPhone, +// VendorStatus: utils.Int64ToStr(req.ShipmentStatus), +// StatusTime: utils.Str2Time(req.OccurredTime), +// Remark: "", +// } +// if req.OccurredTime == "" { +// param.StatusTime = time.Now() +// } +// dispatcherFee := getDispatcherFee(req.ShopID, utils.Int64ToStr(req.ShopOrderID), tiktok_api.DispatcherFeeTypeCall) +// switch req.ShipmentStatus { +// case tiktok_api.ShipmentStatusCalling: //1 骑手呼叫中 +// param.DesiredFee = dispatcherFee +// param.Status = model.WaybillStatusNew //5 待调度 +// case tiktok_api.ShipmentStatusReceived: //2 骑手已接单 +// param.DesiredFee = dispatcherFee +// param.Status = model.WaybillStatusCourierAssigned +// param.Remark = req.RiderName + "," + req.RiderPhone +// case tiktok_api.ShipmentStatusArrived: //3 骑手已到达取货点 +// param.DesiredFee = dispatcherFee +// param.Status = model.WaybillStatusCourierArrived //80 到店 +// param.Remark = tiktok_api.ShipmentStatus[req.ShipmentStatus] +// case tiktok_api.ShipmentStatusDelivering: //4 配送中 +// param.Status = model.WaybillStatusDelivering +// param.Remark = tiktok_api.ShipmentStatus[req.ShipmentStatus] +// case tiktok_api.ShipmentStatusRejected, tiktok_api.ShipmentStatusReturning, tiktok_api.ShipmentStatusReturned: //5 收货人已拒收,6 返回中,7 返回完成 +// param.Status = model.WaybillStatusDeliverFailed +// param.Remark = tiktok_api.ShipmentStatus[req.ShipmentStatus] +// case tiktok_api.ShipmentStatusDelivered: // 8 订单妥投 +// param.Status = model.WaybillStatusDelivered +// param.Remark = tiktok_api.ShipmentStatus[req.ShipmentStatus] +// case tiktok_api.ShipmentStatusCanceled: //9 订单取消 +// param.Status = model.WaybillStatusCanceled +// param.Remark = tiktok_api.ShipmentStatus[req.ShipmentStatus] +// default: +// globals.SugarLogger.Warnf("onWaybillMsg unknown shipmentStatus:%v", req.ShipmentStatus) +// } +// globals.SugarLogger.Debugf("DYPS onWaybillMsg param=====%s", utils.Format4Output(param, false)) +// if err := partner.CurOrderManager.OnWaybillStatusChanged(param); err != nil { +// return tiktok_api.CallbackResponseErr(false) +// } +// return tiktok_api.CallbackResponseErr(true) +//} +// +////以下为辅助函数 +//func getAPI(appOrgCode string) (apiObj *tiktok_api.API) { +// apiObj = partner.CurAPIManager.GetAPI(model.VendorIDDD, appOrgCode).(*tiktok_api.API) +// return apiObj +//}