# 服务动态参数说明

> phone | 2in1 | tablet | tv | wearable

## 服务动态发送场景说明

|场景名称|场景标识（sceneId）|子场景名称|子场景标识（subSceneId）|备注|
|:---|:------------|:----|:----------------|:----------|
|外卖|10001|外卖自取|100010001|外卖自取场景、子场景。|
|外卖|10001|外卖配送|100010002|外卖配送场景、子场景。|

## 外卖自取结构体说明

### TimelineStatusContent全量参数定义

|参数名称|参数类型|描述|
|:-------------|:----------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|status|Integer|服务动态指定场景下指定子场景状态。例如：发送**外卖** 场景下**外卖自取** 子场景"待支付"状态，则status=1。详细参数取值参见[指定状态下发送服务动态参数要求](#指定状态下发送服务动态参数要求)。 取值如下： 1：待支付 2：下单成功 3：制作中 4：制作完成 5：订单完成 6：订单已取消 **说明：** 根据不同状态必传参数、选填参数发送请求。|
|orderTime|Long|下单时间，精确到s级时间戳。示例：1716867321|
|amount|String|金额，商家提供含货币单位金额。最大长度16。示例：￥20.00|
|productCount|Integer|商品数量。范围为[0, 2147483647]，即非负值。|
|productName|String|商品名称。最大长度256。|
|productImg|String|图片SKUId，商家图片托管分配的资源唯一标识。需要通过[申请权益](https://developer.huawei.com/consumer/cn/doc/atomic-guides/push-as-timeline#section592010820304)提供图片获取SKUId。最大长度128。示例：Image_001 **说明：** 如需更换或者新增图片，需要通过[申请图片资源托管](https://developer.huawei.com/consumer/cn/doc/atomic-guides/push-as-timeline#section592010820304)提供图片重新获取SKUId。|
|merchantName|String|商家名称。最大长度256。|
|paymentEndTime|String|支付截止时间。最大长度32。示例：请在17:15前支付|
|remainOrders|String|待制作订单数。最大长度16。示例：3单/共5杯|
|pickupNumber|String|取餐号。最大长度16。示例：1234|
|pickupTime|String|预计取餐时间。最大长度32。示例：14:00|
|waitTime|String|预计等待时间。最大长度16。示例：20-30分钟|
|cancelTime|Long|取消时间，精确到s级时间戳。示例：1716867321|
|cancelReason|String|取消原因，最大长度256。|
|clickAction|[ClickAction](#clickaction) Object|卡片点击事件，详情请参见[ClickAction](#clickaction)。|
|button|[ClickAction](#clickaction) Object|卡片按钮点击事件，详情请参见[ClickAction](#clickaction)。|
|appendButtons|Array [[ClickAction](#clickaction)]|留存页按钮点击事件列表，详情请参见[ClickAction](#clickaction)。|

### 指定状态下发送服务动态参数要求

|状态|状态描述|状态节点类型|必填字段|可选字段|备注|
|:-|:----|:-----|:-------------------------------------------------------------------------------------------------------------|:---------------------------------------|:------------------------------|
|1|待支付|起始节点|status paymentEndTime amount productImg productCount productName merchantName orderTime clickAction|button appendButtons|服务动态消息推送必须以状态节点类型为"起始节点"状态开始推送。|
|2|下单成功|起始节点|status pickupTime amount productName merchantName productImg productCount orderTime clickAction|pickupNumber button appendButtons|服务动态消息推送必须以状态节点类型为"起始节点"状态开始推送。|
|3|制作中|过程节点|status pickupNumber amount productName merchantName productImg productCount orderTime clickAction remainOrders|button appendButtons waitTime pickupTime|-|
|4|制作完成|过程节点|status pickupNumber amount productName merchantName productImg productCount orderTime clickAction|button appendButtons|-|
|5|订单完成|结束节点|status amount productName merchantName productImg productCount orderTime clickAction|pickupNumber button appendButtons|服务动态结束态，订单完成后必须推送该结束状态信息。|
|6|订单已取消|结束节点|status amount productName merchantName productImg productCount orderTime cancelReason cancelTime clickAction|button appendButtons|服务动态结束态，订单取消后必须推送该结束状态信息。|

## 外卖配送结构体说明

### TimelineStatusContent全量参数定义

|参数名称|参数类型|描述|
|:---------------|:----------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|status|Integer|服务动态指定场景下指定子场景状态。例如：发送**外卖** 场景下**外卖配送** 子场景"制作中"状态，则status=3。详细参数取值参见[指定状态下发送服务动态参数要求](#指定状态下发送服务动态参数要求-1)。 取值如下： 1：待支付 2：下单成功 3：制作中 4：制作完成 5：骑手已接单 6：骑手正在赶往商家 7：骑手已到店 8：正在配送 9：已送达 10：订单完成 11：订单已取消 **说明：** 根据不同状态必传参数、选填参数发送请求。|
|amount|String|金额。最大长度16。示例：￥20.00|
|paymentEndTime|String|支付截止时间。最大长度32。示例：请在17:15前支付|
|productImg|String|图片SKUId，商家图片托管分配的资源唯一标识。需要通过[申请权益](https://developer.huawei.com/consumer/cn/doc/atomic-guides/push-as-timeline#section592010820304)提供图片获取SKUId。最大长度128。示例：Image_001 **说明：** 如需更换或者新增图片，需要通过[申请图片资源托管](https://developer.huawei.com/consumer/cn/doc/atomic-guides/push-as-timeline#section592010820304)提供图片重新获取SKUId。|
|productCount|Integer|商品数量。范围为[0, 2147483647]，即非负值。|
|productName|String|商品名称。最大长度256。|
|merchantName|String|商家名称。最大长度256。|
|customerAddress|String|配送地址。最大长度256。|
|orderTime|Long|下单时间，精确到s级时间戳。示例：1716867321|
|deliveryTime|String|预计送达时间。最大长度32。示例：18:10|
|waitTime|String|预计等待时间。最大长度16。示例：20-30分钟|
|realDeliveryTime|Long|实际送达时间，精确到s级时间戳。示例：1716867321|
|remainOrders|String|待制作订单数。最大长度16。示例：3单/共5杯|
|cancelReason|String|取消原因。最大长度256。|
|cancelTime|Long|取消时间，精确到s级时间戳。示例：1716867321|
|riderName|String|骑手名称。最大长度16。|
|riderReceiveTime|Long|骑手接单时间，精确到s级时间戳。示例：1716867321|
|riderPickupTime|Long|骑手取货时间，精确到s级时间戳。示例：1716867321|
|takeawayCabinet|String|外卖柜。最大长度256。示例：1号外卖柜2号格子|
|pickupNumber|String|取餐号。最大长度16。示例：1234|
|clickAction|[ClickAction](#clickaction) Object|卡片点击事件，详情请参见[ClickAction](#clickaction)。|
|button|[ClickAction](#clickaction) Object|卡片按钮点击事件，详情请参见[ClickAction](#clickaction)。|
|appendButtons|Array [[ClickAction](#clickaction)]|留存页按钮点击事件列表，详情请参见[ClickAction](#clickaction)。|

### 指定状态下发送服务动态参数要求

|状态|状态描述|状态节点类型|必填字段|可选字段|备注|
|:-|:-------|:-----|:-----------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------|:------------------------------|
|1|待支付|起始节点|status paymentEndTime amount productImg productCount productName merchantName orderTime customerAddress clickAction|button appendButtons|服务动态消息推送必须以状态节点类型为"起始节点"状态开始推送。|
|2|下单成功|起始节点|status amount productImg productCount productName merchantName orderTime customerAddress clickAction|deliveryTime pickupNumber button appendButtons|服务动态消息推送必须以状态节点类型为"起始节点"状态开始推送。|
|3|制作中|过程节点|status deliveryTime amount productImg productCount productName merchantName orderTime customerAddress remainOrders clickAction|pickupNumber button appendButtons waitTime|-|
|4|制作完成|过程节点|status deliveryTime amount productImg productCount productName merchantName orderTime customerAddress clickAction|pickupNumber button appendButtons|-|
|5|骑手已接单|过程节点|status deliveryTime amount productImg productCount productName merchantName orderTime customerAddress clickAction|pickupNumber button appendButtons|-|
|6|骑手正在赶往商家|过程节点|status deliveryTime amount productImg productCount productName merchantName orderTime customerAddress clickAction|pickupNumber button appendButtons|-|
|7|骑手已到店|过程节点|status deliveryTime amount productImg productCount productName merchantName orderTime customerAddress clickAction|pickupNumber button appendButtons|-|
|8|正在配送|过程节点|status deliveryTime amount productImg productCount productName merchantName orderTime customerAddress clickAction|pickupNumber button appendButtons|-|
|9|已送达|过程节点|status realDeliveryTime amount productImg productCount productName merchantName orderTime customerAddress clickAction|pickupNumber button appendButtons|-|
|10|订单完成|结束节点|status realDeliveryTime amount productImg productCount productName merchantName orderTime customerAddress clickAction|button appendButtons|服务动态结束态，订单完成后必须推送该结束状态信息。|
|11|订单已取消|结束节点|status cancelReason amount productImg productCount productName merchantName orderTime customerAddress cancelTime clickAction|button appendButtons|服务动态结束态，订单取消后必须推送该结束状态信息。|

## 公共参数结构体说明

### ClickAction

|字段名称|是否必填|字段类型|描述|
|:-----|:---|:------|:--------------------------------------------------------------------------------------------------|
|type|是|Integer|消息点击后的跳转行为。 0：打开本元服务首页 1：打开本元服务自定义页|
|text|否|String|按钮文本。如果是按钮点击场景，该字段必填（不能超过4个字符）。|
|action|否|String|应用内置页面ability对应的action。当type为1时，字段action和uri至少填写一个；当action和uri都填写时，优先使用uri查找应用内置页面。|
|uri|否|String|应用内置页面ability对应的uri。当type为1时，字段action和uri至少填写一个。|
|data|否|Object|当type为0或1时，该字段用于在点击按钮后将数据传递给元服务。格式必须为key-value形式，最大长度1024字节。示例：{"key1": "value1", "key2": "value2"}|

