文档
测试

2.获取城市下可选车型及增值服务

POST
api_method:u-city-info

调用注意事项

1.货拉拉车型信息每个城市都是相同的么? 答:货拉拉每个城市下可选的车型可能完全不一样。同时,物理车型也完全不一样。一切以每个城市下获取到的可选车型为准。 2.货拉拉车型信息是固定不变的么? 答:货拉拉车型信息是动态的,由运营进行城市下车型配置。建议开发者在下单前每次获取车型信息。 3.车型附加要求是指什么? 答:车型附加要求是指每个城市下每款车型,可选择的附加的要求。比如要求带有可升降的尾板。是指对车型提出的更高要求。(可能收费) 4.额外需求是指什么? 答:额外需求是指货拉拉开通城市后,每个城市可提供的增值服务。如:回单拍照,返程等。此增值服务随城市信息进行配置。每个城市可能提供的增值服务存在差异。 5.接口返回值中“城市版本号city_info_revision”是指什么? 答:此参数是用于检测控制城市信息有无发生变动。一旦货拉拉运营修改了城市中信息.如:车型数据,车型价格等。此城市版本号将更新。 建议开发者在缓存中记录此城市版本号。在进行计价,下单操作时需传入此值。如果此值不是最新值。则计价,下单接口将报错,报错后续重新获取城市车型信息,重新计价

编码

++数据编码:++ Accept:application/json Content-type: application/json ++字符编码:++ utf-8

前端UI示例

![image.png](https://cos.easydoc.net/48578360/files/k94xy79n)

系统级请求参数

参数名
类型
描述
必填
api_method
string
接口方法名。请传"u-city-info"
必填
api_version
string
接口版本号。请传固定值“1.0”
必填
app_key
string
开发者应用唯一app_key
必填
nonce_str
string
随机数,用户自定义,60s内不可重复使用,用于确保请求不可重复
必填
timestamp
number
unix时间戳(单位:秒),时间戳应为60s内的值,超过60s则超时
必填
signature
stirng
签名值
必填

应用级请求参数(api_data数据结构)

参数名
类型
描述
必填
city_id
number
城市ID,示例:1002
必填

响应参数

参数名
类型
描述
必填
ret
number
返回结果码
必填
msg
string
返回结果描述
必填
data
object
数据字典
必填
city_id
number
城市ID
必填
name
string
城市名称(中文)
必填
name_en
string
城市名称(英文)
必填
city_info_revision
number
城市版本号
必填
vehicle_list
array
城市可选车型列表
必填
order_vehicle_id
number
车型ID
必填
vehicle_name
string
车型名称, 示例:⼩⾯包⻋
必填
img_url_high_light
string
车型图片, 示例:https://ops2.huolala.cn/rs/dist/image
必填
vehicle_volume
string
车型体积, 示例:2.8⽅
必填
vehicle_weight
string
车型载重,示例:500公⽄
必填
vehicle_size
string
车型尺寸,示例:2.1*1.7*1.6
必填
text_desc
string
车型说明,示例:上货、卸货免费等候时⻓总共为40分钟,过后每10分钟加收5元
必填
price_text_item
object
计价规则明细
必填
base_distancekm
number
起步公里数(km), 示例:5
必填
base_price_fen
number
起步价格(分), 示例:5000
必填
exceed_segment_price
array
超里程价格
必填
start_exdistancekm
number
区间起始公里数(km), 示例:6
必填
end_exdistancekm
number
区间结束公里数(km), 示例:40
必填
price_extra_fen
number
区间内每公里收费(分), 示例:400
必填
vehicle_std_item
array
车型可选附加要求
必填
name
string
附加要求名称,示例:双排座
必填
desc
string
附加要求说明, 示例:有4个座椅,适⽤于多⼈跟⻋
必填
price_fen
number
收费(分), 示例:0
必填
spec_req_item
array
城市可选额外需求列表
必填
type
number
额外需求ID,示例:5
必填
name
string
额外需求名称,示例:返程
必填
desc
string
额外需求描述,示例:(附加40%路费)
必填
price_type
number
计价类型(1-固定值计价, 2-百分⽐计价, 3-司机商议,4-免费 )
必填
price_value_fen
number
如果price_type=1,此处为具体价格; 如果 price_type=2, 此处为百分⽐⽐值价, 如果 price_type=3/4,此处为0
必填

请求json示例:

```json { "api_method":"u-city-info", "api_version":"1.0", "app_key":"*************************", "nonce_str":"12345", "timestamp":1574824720, "signature":"****************", "api_data":"{ \"city_id\":1002 }" } ```

返回json示例:

```json { "ret":0, "msg":"", "data":{ "city_id":1014, "name":"⻄安", "name_en":"xian", "city_info_revision":123, "vehicle_list":[ { "order_vehicle_id":73, "vehicle_name":"⼩⾯包⻋", "img_url_high_light":"https://ops2.huolala.cn/rs/dist/image", "vehicle_volume":"2.8⽅", "vehicle_weight":"500公⽄", "vehicle_size":"2.1*1.7*1.6", "text_desc":"上货、卸货免费等候时⻓总共为40分钟,过后每10分钟加收5元", "price_text_item":{ "base_distancekm":5, "base_price_fen":5000, "exceed_segment_price":[ { "end_exdistancekm":999999, "price_extra_fen":400, "start_exdistancekm":6 } ] }, "vehicle_std_item":[ { "desc":"有4个座椅,适⽤于多⼈跟⻋", "price_fen":0, "name":"双排座" } ] } ], "spec_req_item":[ { "price_value_fen":40, "name":"返程", "price_type":2, "type":5, "desc":"(附加40%路费)" }, { "price_value_fen":0, "name":"⼩推⻋", "price_type":4, "type":2, "desc":"(免费)" } ] } } ```

返回状态码说明

|状态码|说明|建议处理方式| |-|-|-|-| |30011|城市未开通|再次调用获取城市列表|