物流助手 /小程序使用 /bindAccount # logistics.bindAccount > 本接口应在服务器端调用,详细说明参见[服务端API](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/backend-api.html)。 > 本接口支持[云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)。需开发者工具版本 >= `1.02.1904090`(最新[稳定版下载](https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html)),`wx-server-sdk` >= `0.4.0` 绑定、解绑物流账号 调用方式: - [HTTPS 调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.bindAccount.html#method-http) - [云调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.bindAccount.html#method-cloud) ## HTTPS 调用 ### 请求地址 ```text POST https://api.weixin.qq.com/cgi-bin/express/business/account/bind?access_token=ACCESS_TOKEN ``` ### 请求参数 | 属性 | 类型 | 默认值 | 必填 | 说明 | | :------------------------------------ | :----- | :----- | :--- | :----------------------------------------------------------- | | access_token / cloudbase_access_token | string | | 是 | [接口调用凭证](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html) | | type | string | | 是 | bind表示绑定,unbind表示解除绑定 | | biz_id | string | | 是 | 快递公司客户编码 | | delivery_id | string | | 是 | 快递公司ID | | password | string | | 否 | 快递公司客户密码, ems,顺丰,京东非必填 | | remark_content | string | | 否 | 备注内容(提交 EMS 审核需要) 格式要求: 电话:xxxxx 联系人:xxxxx 服务类型:xxxxx 发货地址:xxxx | ### 返回值 ### Object | 属性 | 类型 | 说明 | | :------ | :----- | :------- | | errcode | number | 错误码 | | errmsg | string | 错误信息 | **errcode 的合法值** | 值 | 说明 | 最低版本 | | :------ | :----------------- | :------- | | 0 | 成功 | | | -1 | 系统失败 | | | 9300529 | 账号已绑定过 | | | 9300530 | 解绑的biz_id不存在 | | | 9300531 | 账号或密码错误 | | | 9300532 | 绑定已提交,审核中 | | ### 请求数据示例 ```json { "type": "bind", "biz_id": "123456", "delivery_id": "YUNDA", "password": "123456789123456789" } ``` ### 返回数据示例 ```json { "errcode": 0, "errmsg": "ok" } ``` ## 云调用 > [云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)是微信云开发提供的在云函数中调用微信开放接口的能力,需要在云函数中通过 `wx-server-sdk` 使用。 ### 接口方法 ```js openapi.logistics.bindAccount ``` > 需在 `config.json` 中配置 `logistics.bindAccount` API 的权限,[详情](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html#usage-3) ### 请求参数 | 属性 | 类型 | 默认值 | 必填 | 说明 | | :------------ | :----- | :----- | :--- | :----------------------------------------------------------- | | type | string | | 是 | bind表示绑定,unbind表示解除绑定 | | bizId | string | | 是 | 快递公司客户编码 | | deliveryId | string | | 是 | 快递公司ID | | password | string | | 否 | 快递公司客户密码, ems,顺丰,京东非必填 | | remarkContent | string | | 否 | 备注内容(提交 EMS 审核需要) 格式要求: 电话:xxxxx 联系人:xxxxx 服务类型:xxxxx 发货地址:xxxx | ### 返回值 ### Object | 属性 | 类型 | 说明 | | :------ | :----- | :------- | | errCode | number | 错误码 | | errMsg | string | 错误信息 | **errCode 的合法值** | 值 | 说明 | 最低版本 | | :--- | :--- | :------- | | 0 | 成功 | | ### 异常 ### Object 抛出的异常 | 属性 | 类型 | 说明 | | :------ | :----- | :------- | | errCode | number | 错误码 | | errMsg | string | 错误信息 | **errCode 的合法值** | 值 | 说明 | 最低版本 | | :------ | :----------------- | :------- | | -1 | 系统失败 | | | 9300529 | 账号已绑定过 | | | 9300530 | 解绑的biz_id不存在 | | | 9300531 | 账号或密码错误 | | | 9300532 | 绑定已提交,审核中 | | ### 请求数据示例 ```js const cloud = require('wx-server-sdk') cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV, }) exports.main = async (event, context) => { try { const result = await cloud.openapi.logistics.bindAccount({ "type": 'bind', "password": '123456789123456789', "bizId": '123456', "deliveryId": 'YUNDA' }) return result } catch (err) { return err } } ``` ### 返回数据示例 ```json { "errCode": 0, "errMsg": "openapi.logistics.bindAccount:ok" } ```