updateBusiness.md 5.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
物流助手 /运力方使用 /updateBusiness

# logistics.updateBusiness

> 本接口应在服务器端调用,详细说明参见[服务端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-provider/logistics.updateBusiness.html#method-http)
- [云调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-provider/logistics.updateBusiness.html#method-cloud)



## HTTPS 调用

### 请求地址

```text
POST https://api.weixin.qq.com/cgi-bin/express/delivery/service/business/update?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) |
| shop_app_id                           | string |        | 是   | 商户的小程序AppID,即[审核商户](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-provider/logistics.onCheckBusiness.html)事件中的 ShopAppID |
| biz_id                                | string |        | 是   | 商户账户                                                     |
| result_code                           | number |        | 是   | 审核结果,0 表示审核通过,其他表示审核失败                   |
| result_msg                            | string |        | 否   | 审核错误原因,仅 result_code 不等于 0 时需要设置             |

### 返回值

### Object

| 属性    | 类型   | 说明     |
| :------ | :----- | :------- |
| errcode | number | 错误码   |
| errmsg  | string | 错误信息 |

**errcode 的合法值**

| 值      | 说明                   | 最低版本 |
| :------ | :--------------------- | :------- |
| 0       | 成功                   |          |
| -1      | 其他错误               |          |
| 40013   | 非法的商户小程序 AppID |          |
| 9300525 | 商户未申请过审核       |          |

### 请求数据示例

```json
{
  "shop_app_id": "wxABCD",
  "biz_id": "xyz",
  "result_code": 0,
  "result_msg": "审核通过"
}
```

### 返回数据示例

```json
{
  "errcode": 0,
  "errmsg": "ok"
}
```



## 云调用

> [云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)是微信云开发提供的在云函数中调用微信开放接口的能力,需要在云函数中通过 `wx-server-sdk` 使用。

### 接口方法

```js
openapi.logistics.updateBusiness
```

> 需在 `config.json` 中配置 `logistics.updateBusiness` API 的权限,[详情](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html#usage-3)

### 请求参数

| 属性       | 类型   | 默认值 | 必填 | 说明                                                         |
| :--------- | :----- | :----- | :--- | :----------------------------------------------------------- |
| shopAppId  | string |        | 是   | 商户的小程序AppID,即[审核商户](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-provider/logistics.onCheckBusiness.html)事件中的 ShopAppID |
| bizId      | string |        | 是   | 商户账户                                                     |
| resultCode | number |        | 是   | 审核结果,0 表示审核通过,其他表示审核失败                   |
| resultMsg  | string |        | 否   | 审核错误原因,仅 result_code 不等于 0 时需要设置             |

### 返回值

### Object

| 属性    | 类型   | 说明     |
| :------ | :----- | :------- |
| errCode | number | 错误码   |
| errMsg  | string | 错误信息 |

**errCode 的合法值**

| 值   | 说明 | 最低版本 |
| :--- | :--- | :------- |
| 0    | 成功 |          |

### 异常

### Object

抛出的异常

| 属性    | 类型   | 说明     |
| :------ | :----- | :------- |
| errCode | number | 错误码   |
| errMsg  | string | 错误信息 |

**errCode 的合法值**

| 值      | 说明                   | 最低版本 |
| :------ | :--------------------- | :------- |
| -1      | 其他错误               |          |
| 40013   | 非法的商户小程序 AppID |          |
| 9300525 | 商户未申请过审核       |          |

### 请求数据示例

```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.updateBusiness({
        "shopAppId": 'wxABCD',
        "bizId": 'xyz',
        "resultCode": 0,
        "resultMsg": '审核通过'
      })
    return result
  } catch (err) {
    return err
  }
}
```

### 返回数据示例

```json
{
  "errCode": 0,
  "errMsg": "openapi.logistics.updateBusiness:ok"
}
```