This commit is contained in:
richboo111
2023-06-12 14:16:00 +08:00
parent 3293103285
commit 866aa16bc5
5 changed files with 31 additions and 7 deletions

View File

@@ -589,7 +589,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
storeIDs2 = append(storeIDs2, k) storeIDs2 = append(storeIDs2, k)
} }
} else { } else {
//storeIDs2 = append(storeIDs2, -1) //storeIDs2 = append(storeIDs2, -1)l
// 商家小程序用户切换门店,如果角色storeIDsMap没有数据则查询传入数据 // 商家小程序用户切换门店,如果角色storeIDsMap没有数据则查询传入数据
storeIDs2 = append(storeIDs2, int(utils.Interface2Int64WithDefault(params["storeID"], 0))) storeIDs2 = append(storeIDs2, int(utils.Interface2Int64WithDefault(params["storeID"], 0)))
} }

View File

@@ -155,6 +155,8 @@ func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee i
delivery.OnWaybillCreated(bill) delivery.OnWaybillCreated(bill)
//todo 模拟新运单回调 //todo 模拟新运单回调
if _, err = partner.CurOrderManager.LoadWaybill(sfOrderID, model.VendorIDSFPS); fmt.Sprintf("%s", err) == "找不到相应运单" { if _, err = partner.CurOrderManager.LoadWaybill(sfOrderID, model.VendorIDSFPS); fmt.Sprintf("%s", err) == "找不到相应运单" {
//忽略找不到运单错误
err = nil
resp := OnWaybillMsg(sfps2.UrlIndexRiderStatus, sfps2.RiderStatus{ resp := OnWaybillMsg(sfps2.UrlIndexRiderStatus, sfps2.RiderStatus{
ShopId: utils.Str2Float64(sfps2.SFShopStoreID), ShopId: utils.Str2Float64(sfps2.SFShopStoreID),
SFOrderID: sfOrderID, SFOrderID: sfOrderID,
@@ -254,7 +256,9 @@ func (d DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeison
sfOrder, err := api.SfPsAPI.GetOrderStatus(order[0].VendorWaybillID) sfOrder, err := api.SfPsAPI.GetOrderStatus(order[0].VendorWaybillID)
//获取顺丰骑手实时位置 //获取顺丰骑手实时位置
sfRider, err := api.SfPsAPI.GetRiderLatestPosition(sfOrder.OrderID) sfRider, err := api.SfPsAPI.GetRiderLatestPosition(sfOrder.OrderID)
if sfRider == nil {
return nil, errors.New("顺丰派送暂无骑手信息")
}
result := &mtpsapi.RiderInfo{ result := &mtpsapi.RiderInfo{
OrderId: orderId, OrderId: orderId,
ThirdCarrierOrderId: sfOrder.OrderID, ThirdCarrierOrderId: sfOrder.OrderID,
@@ -299,6 +303,15 @@ func (c *DeliveryHandler) GetWaybillTip(ctx *jxcontext.Context, vendorOrgCode, v
return api.SfPsAPI.QueryTipFee(vendorWaybillID) return api.SfPsAPI.QueryTipFee(vendorWaybillID)
} }
func (c *DeliveryHandler) GetRidderPosition(ctx *jxcontext.Context, vendorOrgCode, vendorOrderID, vendorWaybillID, vendorWaybillID2 string) (lng, lat float64, err error) {
if rider, err := api.SfPsAPI.GetRiderLatestPosition(vendorWaybillID); err == nil && len(rider.RiderLng) > 0 && len(rider.RiderLat) > 0 {
lng = utils.Str2Float64(rider.RiderLng)
lat = utils.Str2Float64(rider.RiderLat)
return lng, lat, nil
}
return 0, 0, err
}
func (c *DeliveryHandler) UpdateWaybillTip(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID, vendorOrderID, vendorWaybillID, vendorWaybillID2, cityCode string, tipFee int64) (err error) { func (c *DeliveryHandler) UpdateWaybillTip(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID, vendorOrderID, vendorWaybillID, vendorWaybillID2, cityCode string, tipFee int64) (err error) {
return api.SfPsAPI.AddTipFee(vendorWaybillID, tipFee) return api.SfPsAPI.AddTipFee(vendorWaybillID, tipFee)
} }
@@ -396,7 +409,7 @@ func OnWaybillMsg(urlIndex string, msg interface{}) (resp *sfps2.CallbackRespons
case sfps2.OrderStatusFinished: case sfps2.OrderStatusFinished:
result.LogisticsStatus = model.WaybillStatusDelivered result.LogisticsStatus = model.WaybillStatusDelivered
result.LogisticsContext = model.RiderGetOrderDelivered result.LogisticsContext = model.RiderGetOrderDelivered
case sfps2.OrderStatusOrderCancel: case sfps2.OrderStatusOrderCancel, sfps2.OrderStatusRiderCancel:
result.LogisticsStatus = model.WaybillStatusCanceled result.LogisticsStatus = model.WaybillStatusCanceled
result.LogisticsContext = model.RiderGetOrderCanceled result.LogisticsContext = model.RiderGetOrderCanceled
case sfps2.OrderStatusError: case sfps2.OrderStatusError:

View File

@@ -259,6 +259,18 @@ func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId
return api.UuAPI.GetOrderLiquidatedDamages(deliverId, orderId) return api.UuAPI.GetOrderLiquidatedDamages(deliverId, orderId)
} }
func (c *DeliveryHandler) GetRidderPosition(ctx *jxcontext.Context, vendorOrgCode, vendorOrderID, vendorWaybillID, vendorWaybillID2 string) (lng, lat float64, err error) {
if rider, err := api.UuAPI.GetOrderDetail(vendorWaybillID); err == nil && len(rider.DriverLastloc) > 0 {
te := strings.Split(rider.DriverLastloc, ",")
if len(te) > 0 {
lng = utils.Str2Float64(te[0])
lat = utils.Str2Float64(te[1])
}
return lng, lat, nil
}
return 0, 0, err
}
//辅助函数 //辅助函数
func getOrderPrice(order *model.GoodsOrder) (orderPrice *uuptapi.GetOrderPriceResp, err error) { func getOrderPrice(order *model.GoodsOrder) (orderPrice *uuptapi.GetOrderPriceResp, err error) {
store, err := dao.GetStoreDetail(dao.GetDB(), getReallyStoreID(order.StoreID, order.JxStoreID), 0, "") store, err := dao.GetStoreDetail(dao.GetDB(), getReallyStoreID(order.StoreID, order.JxStoreID), 0, "")

View File

@@ -92,6 +92,7 @@ func PingTimer() {
} }
globals.SugarLogger.Debugf("PingTimer jx clientID ") globals.SugarLogger.Debugf("PingTimer jx clientID ")
} else { } else {
fmt.Printf("PingTimer mt心跳conn%s,%s", conn.ClientId, conn.ClientType)
if err := conn.Socket.WriteMessage(websocket.TextMessage, []byte(HeartCheckMsg)); err != nil { if err := conn.Socket.WriteMessage(websocket.TextMessage, []byte(HeartCheckMsg)); err != nil {
fmt.Printf("PingTimer mtHeartBeat err:%v", err) fmt.Printf("PingTimer mtHeartBeat err:%v", err)
//对美团重新建立连接 //对美团重新建立连接

View File

@@ -24,15 +24,13 @@ func (c *SFPSController) SfOrder() {
c.ServeJSON() c.ServeJSON()
return return
} }
// 订单回调 // 订单回调
for k, v := range msg { for k, v := range msg {
callbackResponse = sfps.OnWaybillMsg(k, v) callbackResponse = sfps.OnWaybillMsg(k, v)
c.Data["data"] = callbackResponse c.Data["data"] = callbackResponse
fmt.Printf("SfOrder callbackResponse=%s", utils.Format4Output(callbackResponse, false)) fmt.Printf("SfOrder callbackResponse=%s", utils.Format4Output(callbackResponse, false))
err := c.ServeJSON() c.ServeJSON()
if err != nil {
fmt.Printf("serveJSON err=%v", err)
}
} }
} else { } else {
c.Abort("404") c.Abort("404")