a
This commit is contained in:
@@ -29,7 +29,7 @@ const (
|
|||||||
weimobTokenExpires = 7200 * time.Second
|
weimobTokenExpires = 7200 * time.Second
|
||||||
yilianyunTokenExpires = 30 * 24 * 3600 * time.Second
|
yilianyunTokenExpires = 30 * 24 * 3600 * time.Second
|
||||||
pushTokenExpires = 7200 * time.Second
|
pushTokenExpires = 7200 * time.Second
|
||||||
fnTokenExpires = 12 * time.Hour
|
fnTokenExpires = 6 * time.Hour
|
||||||
|
|
||||||
maxRefreshGap = 5 * 60 * time.Second
|
maxRefreshGap = 5 * 60 * time.Second
|
||||||
errRefreshGap = 10 * time.Second
|
errRefreshGap = 10 * time.Second
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ var (
|
|||||||
WaybillStatusPending: "压单",
|
WaybillStatusPending: "压单",
|
||||||
WaybillStatusAcceptCanceled: "取消接受",
|
WaybillStatusAcceptCanceled: "取消接受",
|
||||||
WaybillStatusAccepted: "已接单",
|
WaybillStatusAccepted: "已接单",
|
||||||
|
WaybillStatusCourierAssigned: "已分配骑手",
|
||||||
WaybillStatusCourierArrived: "已到店",
|
WaybillStatusCourierArrived: "已到店",
|
||||||
WaybillStatusApplyFailedGetGoods: "取货失败待审核",
|
WaybillStatusApplyFailedGetGoods: "取货失败待审核",
|
||||||
WaybillStatusAgreeFailedGetGoods: "取货失败",
|
WaybillStatusAgreeFailedGetGoods: "取货失败",
|
||||||
@@ -306,11 +307,12 @@ const (
|
|||||||
WaybillStatusRefuseFailedGetGoods = -70
|
WaybillStatusRefuseFailedGetGoods = -70
|
||||||
WaybillStatusUnknown = 0
|
WaybillStatusUnknown = 0
|
||||||
|
|
||||||
WaybillStatusNew = 5
|
WaybillStatusNew = 5
|
||||||
WaybillStatusPending = 7
|
WaybillStatusPending = 7
|
||||||
WaybillStatusAcceptCanceled = 8
|
WaybillStatusAcceptCanceled = 8
|
||||||
WaybillStatusAccepted = 10
|
WaybillStatusAccepted = 10
|
||||||
WaybillStatusCourierArrived = 15 // 此状态是可选的,明确写出来是因为还是较重要的状态,但业务逻辑不应依赖此状态
|
WaybillStatusCourierAssigned = 12 //已分配骑手
|
||||||
|
WaybillStatusCourierArrived = 15 // 此状态是可选的,明确写出来是因为还是较重要的状态,但业务逻辑不应依赖此状态
|
||||||
|
|
||||||
WaybillStatusApplyFailedGetGoods = 17 // 取货失败待审核
|
WaybillStatusApplyFailedGetGoods = 17 // 取货失败待审核
|
||||||
WaybillStatusAgreeFailedGetGoods = 18 // 取货失败
|
WaybillStatusAgreeFailedGetGoods = 18 // 取货失败
|
||||||
|
|||||||
@@ -114,3 +114,34 @@ func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInf
|
|||||||
|
|
||||||
return deliveryFeeInfo, err
|
return deliveryFeeInfo, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func OnWaybillMsg(msg *fnpsapi.WayBillInfo) {
|
||||||
|
order := &model.Waybill{
|
||||||
|
VendorWaybillID: msg.PartnerOrderCode,
|
||||||
|
VendorWaybillID2: msg.PartnerOrderCode,
|
||||||
|
WaybillVendorID: model.VendorIDFengNiao,
|
||||||
|
CourierName: msg.CarrierDriverName,
|
||||||
|
CourierMobile: msg.CarrierDriverPhone,
|
||||||
|
VendorStatus: utils.Int2Str(msg.OrderStatus),
|
||||||
|
StatusTime: utils.Timestamp2Time(msg.PushTime),
|
||||||
|
Remark: msg.Description,
|
||||||
|
}
|
||||||
|
order.VendorOrderID, order.OrderVendorID = jxutils.SplitUniversalOrderID(msg.PartnerOrderCode)
|
||||||
|
switch msg.OrderStatus {
|
||||||
|
case fnpsapi.OrderStatusAccept:
|
||||||
|
order.Status = model.WaybillStatusAccepted
|
||||||
|
case fnpsapi.OrderStatusAssigned:
|
||||||
|
order.Status = model.WaybillStatusCourierAssigned
|
||||||
|
case fnpsapi.OrderStatusArrived:
|
||||||
|
order.Status = model.WaybillStatusCourierArrived
|
||||||
|
case fnpsapi.OrderStatusDelivering:
|
||||||
|
order.Status = model.WaybillStatusDelivering
|
||||||
|
case fnpsapi.OrderStatusDelivered:
|
||||||
|
order.Status = model.WaybillStatusDelivered
|
||||||
|
case fnpsapi.OrderStatusException:
|
||||||
|
order.Status = model.WaybillStatusDeliverFailed
|
||||||
|
default:
|
||||||
|
globals.SugarLogger.Warnf("onWaybillMsg unknown msg:%v", msg)
|
||||||
|
}
|
||||||
|
partner.CurOrderManager.OnWaybillStatusChanged(order)
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package controllers
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -12,7 +14,10 @@ type FnController struct {
|
|||||||
|
|
||||||
func (c *FnController) Msg() {
|
func (c *FnController) Msg() {
|
||||||
if c.Ctx.Input.Method() == http.MethodPost {
|
if c.Ctx.Input.Method() == http.MethodPost {
|
||||||
|
msg := api.FnAPI.GetOrderCallbackMsg(c.Ctx.Request)
|
||||||
|
if msg != nil {
|
||||||
|
fn.OnWaybillMsg(msg)
|
||||||
|
}
|
||||||
c.Data["json"] = ""
|
c.Data["json"] = ""
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user