# 运单轨迹更新事件

> 本文档描述服务器端接收的消息或事件，详细说明参见[消息推送](/miniprogram/dev/framework/server-ability/message-push.md)。

事件英文名：logistics.onPathUpdate

运单轨迹更新事件。当运单轨迹有更新时，会触发此事件并产生数据包。

## 1. 消息参数

### 请求体 `Request Payload`

```json
[
  {
    "参数名": "ToUserName",
    "类型": "string",
    "说明": "小程序的原始ID"
  },
  {
    "参数名": "FromUserName",
    "类型": "string",
    "说明": "发送者的openid"
  },
  {
    "参数名": "CreateTime",
    "类型": "number",
    "说明": "消息创建时间（整型）"
  },
  {
    "参数名": "MsgType",
    "类型": "string",
    "说明": "固定 event"
  },
  {
    "参数名": "Event",
    "类型": "string",
    "说明": "固定 add_express_path"
  },
  {
    "参数名": "DeliveryID",
    "类型": "string",
    "说明": "快递公司ID"
  },
  {
    "参数名": "WayBillId",
    "类型": "string",
    "说明": "运单ID"
  },
  {
    "参数名": "OrderId",
    "类型": "string",
    "说明": "订单ID"
  },
  {
    "参数名": "Version",
    "类型": "number",
    "说明": "轨迹版本号（整型）"
  },
  {
    "参数名": "Count",
    "类型": "number",
    "说明": "轨迹节点数（整型）"
  },
  {
    "参数名": "Actions",
    "类型": "objarray",
    "说明": "轨迹列表"
  }
]
```

">

### Body.Actions(Array) `Object Payload`

轨迹列表

```json
[
  {
    "参数名": "ActionTime",
    "类型": "number",
    "说明": "轨迹节点 Unix 时间戳",
    "枚举": "-"
  },
  {
    "参数名": "ActionType",
    "类型": "number",
    "说明": "轨迹节点类型",
    "枚举": "枚举值"
  },
  {
    "参数名": "ActionMsg",
    "类型": "string",
    "说明": "轨迹节点详情",
    "枚举": "-"
  }
]
```

## 2. 消息返回

### 返回体 `Response Payload`

回复 `success` 或空字符串（无需加密）

## 3. 枚举信息

__ActionType">

### Body.Actions(Array).ActionType `Enum`

轨迹节点类型

```json
[
  {
    "枚举值": "100001",
    "描述": "揽件阶段-揽件成功"
  },
  {
    "枚举值": "100002",
    "描述": "揽件阶段-揽件失败"
  },
  {
    "枚举值": "100003",
    "描述": "揽件阶段-分配业务员"
  },
  {
    "枚举值": "200001",
    "描述": "运输阶段-更新运输轨迹"
  },
  {
    "枚举值": "300002",
    "描述": "派送阶段-开始派送"
  },
  {
    "枚举值": "300003",
    "描述": "派送阶段-签收成功"
  },
  {
    "枚举值": "300004",
    "描述": "派送阶段-签收失败"
  },
  {
    "枚举值": "400001",
    "描述": "异常阶段-订单取消"
  },
  {
    "枚举值": "400002",
    "描述": "异常阶段-订单滞留"
  }
]
```

## 4. 注意事项

本事件无特殊注意事项

## 5. 代码示例

### 5.1 XML 示例

请求示例

```xml
<xml>
  <ToUserName><![CDATA[toUser]]></ToUserName>
  <FromUserName><![CDATA[fromUser]]></FromUserName>
  <CreateTime>1546924844</CreateTime>
  <MsgType><![CDATA[event]]></MsgType>
  <Event><![CDATA[add_express_path]]></Event>
  <DeliveryID><![CDATA[SF]]></DeliveryID>
  <WayBillId><![CDATA[123456789]]></WayBillId>
  <OrderId><![CDATA[123456]]></OrderId>
  <Version>3</Version>
  <Count>3</Count>
  <Actions>
    <ActionTime>1546924840</ActionTime>
    <ActionType>100001</ActionType>
    <ActionMsg><![CDATA[小哥A揽件成功]]></ActionMsg>
  </Actions>
  <Actions>
    <ActionTime>1546924841</ActionTime>
    <ActionType>200001</ActionType>
    <ActionMsg><![CDATA[到达广州集包地]]></ActionMsg>
  </Actions>
  <Actions>
    <ActionTime>1546924842</ActionTime>
    <ActionType>200001</ActionType>
    <ActionMsg><![CDATA[运往目的地]]></ActionMsg>
  </Actions>
</xml>
```

返回示例

```
success
```

### 5.2 JSON 示例

请求示例

```json
{
  "ToUserName": "toUser",
  "FromUserName": "fromUser",
  "CreateTime": 1546924844,
  "MsgType": "event",
  "Event": "add_express_path",
  "DeliveryID": "SF",
  "WayBillId": "123456789",
  "OrderId": "123456789",
  "Version": 2,
  "Count": 3,
  "Actions": [
    {
      "ActionTime": 1546924840,
      "ActionType": 100001,
      "ActionMsg": "小哥A揽件成功"
    },
    {
      "ActionTime": 1546924841,
      "ActionType": 200001,
      "ActionMsg": "到达广州集包地"
    },
    {
      "ActionTime": 1546924842,
      "ActionType": 200001,
      "ActionMsg": "运往目的地"
    }
  ]
}
```

返回示例

```
success
```
