sfps callback
This commit is contained in:
@@ -153,6 +153,21 @@ func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee i
|
||||
ActualFee: utils.Float64TwoInt64(sfReallyPrice),
|
||||
}
|
||||
delivery.OnWaybillCreated(bill)
|
||||
//todo 模拟新运单回调
|
||||
OnWaybillMsg(sfps2.UrlIndexRiderStatus, &sfps2.RiderStatus{
|
||||
ShopId: utils.Str2Float64(sfps2.SFShopStoreID),
|
||||
SFOrderID: sfOrderID,
|
||||
ShopOrderID: order.VendorOrderID,
|
||||
UrlIndex: sfps2.UrlIndexRiderStatus,
|
||||
OperatorName: "",
|
||||
OperatorPhone: "",
|
||||
RiderLng: 0,
|
||||
RiderLat: 0,
|
||||
OrderStatus: sfps2.OrderStatusNewOrder,
|
||||
StatusDesc: sfps2.OrderStatusNewOrderDesc,
|
||||
SFUCode: "",
|
||||
PushTime: int(time.Now().Unix()),
|
||||
})
|
||||
return bill, err
|
||||
}
|
||||
|
||||
@@ -278,16 +293,6 @@ func (d DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeison
|
||||
// OnWaybillMsg 配送状态更改回调
|
||||
func OnWaybillMsg(urlIndex string, msg interface{}) (resp *sfps2.CallbackResponse) {
|
||||
order := GetWaybillByStatus(urlIndex, msg)
|
||||
//order := &model.Waybill{
|
||||
// VendorWaybillID: msg.SFOrderID,
|
||||
// WaybillVendorID: model.VendorIDSFPS,
|
||||
// VendorOrderID: msg.ShopOrderID,
|
||||
// CourierName: msg.OperatorName,
|
||||
// CourierMobile: msg.OperatorPhone,
|
||||
// VendorStatus: utils.Int2Str(msg.OrderStatus),
|
||||
// StatusTime: utils.Timestamp2Time(int64(msg.PushTime)),
|
||||
// Remark: msg.StatusDesc,
|
||||
//}
|
||||
|
||||
//获取实时订单信息
|
||||
sfOrder, err := api.SfPsAPI.GetOrderStatus(order.VendorWaybillID)
|
||||
@@ -398,7 +403,7 @@ func OnWaybillExceptSF(msg *sfps2.RiderException) (retVal *sfps2.CallbackRespons
|
||||
CourierName: msg.OperatorName,
|
||||
CourierMobile: "",
|
||||
Status: model.WaybillStatusUnknown, // todo 这里要再确定一下是否只要收到订单异常消息就只简单当成一个消息
|
||||
VendorStatus: utils.Int2Str(msg.OrderStatus),
|
||||
VendorStatus: utils.Float64ToStr(msg.OrderStatus),
|
||||
StatusTime: utils.Timestamp2Time(int64(msg.PushTime)),
|
||||
}
|
||||
order.VendorOrderID, order.OrderVendorID = jxutils.SplitUniversalOrderID(msg.ShopOrderID)
|
||||
@@ -419,7 +424,7 @@ func GetWaybillByStatus(urlIndex string, msg interface{}) *model.Waybill {
|
||||
VendorOrderID: retVal.ShopOrderID,
|
||||
CourierName: retVal.OperatorName,
|
||||
CourierMobile: retVal.OperatorPhone,
|
||||
VendorStatus: utils.Int2Str(retVal.OrderStatus),
|
||||
VendorStatus: utils.Float64ToStr(retVal.OrderStatus),
|
||||
StatusTime: utils.Timestamp2Time(int64(retVal.PushTime)),
|
||||
Remark: retVal.StatusDesc,
|
||||
}
|
||||
@@ -432,7 +437,7 @@ func GetWaybillByStatus(urlIndex string, msg interface{}) *model.Waybill {
|
||||
VendorWaybillID: retVal.SFOrderID,
|
||||
WaybillVendorID: model.VendorIDSFPS,
|
||||
VendorOrderID: retVal.ShopOrderID,
|
||||
VendorStatus: utils.Int2Str(retVal.OrderStatus),
|
||||
VendorStatus: utils.Float64ToStr(retVal.OrderStatus),
|
||||
StatusTime: utils.Timestamp2Time(int64(retVal.PushTime)),
|
||||
Remark: retVal.StatusDesc,
|
||||
}
|
||||
@@ -446,7 +451,7 @@ func GetWaybillByStatus(urlIndex string, msg interface{}) *model.Waybill {
|
||||
WaybillVendorID: model.VendorIDSFPS,
|
||||
VendorOrderID: retVal.ShopOrderID,
|
||||
CourierName: retVal.OperatorName,
|
||||
VendorStatus: utils.Int2Str(retVal.OrderStatus),
|
||||
VendorStatus: utils.Float64ToStr(retVal.OrderStatus),
|
||||
StatusTime: utils.Timestamp2Time(int64(retVal.PushTime)),
|
||||
Remark: retVal.StatusDesc,
|
||||
}
|
||||
|
||||
@@ -79,10 +79,7 @@ func PingTimer() {
|
||||
go func() {
|
||||
ticker := time.NewTicker(heartbeatInterval)
|
||||
defer ticker.Stop()
|
||||
//测试用
|
||||
//i := 0
|
||||
for {
|
||||
//i++
|
||||
<-ticker.C
|
||||
for clientId, conn := range Manager.AllClient() {
|
||||
if conn.ClientType == ClientTypeJx {
|
||||
@@ -93,12 +90,14 @@ func PingTimer() {
|
||||
if err := ConnRender(conn.Socket, renderData{ClientId: clientId}); err != nil {
|
||||
return
|
||||
}
|
||||
globals.SugarLogger.Debugf("PingTimer jx clientID ")
|
||||
} else {
|
||||
if err := conn.Socket.WriteMessage(websocket.TextMessage, []byte(HeartCheckMsg)); err != nil {
|
||||
fmt.Printf("PingTimer mtHeartBeat err:%v", err)
|
||||
//对美团重新建立连接
|
||||
MtInit()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,7 +158,7 @@ func (c *Client) Read() {
|
||||
}
|
||||
}
|
||||
fmt.Printf("Client Read:receive: %s\n", string(msg))
|
||||
SendToVendor(msg)
|
||||
//SendToVendor(msg)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user