getGoodsAuditInfo.md 4.05 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
小程序直播 /商品管理 /获取商品的信息与审核状态

# 获取商品的信息与审核状态

> 接口应在服务器端调用,详细说明参见[服务端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`

## 接口说明

### 接口英文名

getGoodsAuditInfo

### 功能描述

该接口用于获取商品的信息与审核状态。

## 调用方式

### HTTPS 调用

```text
POST https://api.weixin.qq.com/wxa/business/getgoodswarehouse?access_token=ACCESS_TOKEN 
```

### 云调用

- 出入参和 HTTPS 调用相同,调用方式可查看[云调用说明文档](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)
- 接口方法为: openapi.liveBroadcast.goodsInfo

### 第三方调用

- 调用方式以及出入参和 HTTPS 相同,仅是调用的 token 不同
- 该接口所属的权限集 id 为:52
- 服务商获得其中之一权限集授权后,可通过使用[authorizer_access_token](https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/api_authorizer_token.html)代商家进行调用

### 请求参数含义

| **参数**  | **类型**      | **必填** | **说明** |
| :-------- | :------------ | :------- | :------- |
| goods_ids | Array<Number> | 是       | 商品ID   |

### 返回参数含义

| **参数**        | **说明**                                                     |
| :-------------- | :----------------------------------------------------------- |
| goods_id        | 商品ID                                                       |
| name            | 商品名称                                                     |
| cover_img_url   | 商品图片url                                                  |
| url             | 商品详情页的小程序路径                                       |
| priceType       | 1:一口价,此时读 price 字段; 2:价格区间,此时 price 字段为左边界,price2字段为右边界; 3:折扣价,此时 price 字段为原价,price2字段为现价; |
| price           | 价格左区间,单位“元”                                         |
| price2          | 价格右区间,单位“元”                                         |
| audit_status    | 0:未审核,1:审核中,2:审核通过,3审核失败                  |
| third_party_tag | 1、2:表示是为 API 添加商品,否则是直播控制台添加的商品      |
| thirdPartyAppid | 当商品为第三方小程序的商品则为对应第三方小程序的appid,自身小程序商品则为'' |
| total           | 商品个数                                                     |

## 调用示例

> 示例说明: HTTPS调用示例

### 请求数据示例

```json
{
    "goods_ids": [1] //最多支持一次获取20个商品状态
} 
```

### 返回数据示例

```json
{
    "errcode":0,
    "errmsg":"ok",
    "goods":
        [
            {
                "goods_id":9,
                "cover_img_url":"xxxx",
                "name":"xxxxx"
                "price":12300,
                "url":"xxxxxxx",
                "price_type":1,
                "price2":0,
                "audit_status":1,
                "third_party_tag":0
            }
        ],
    "total":0
} 
```

### 错误码

| 错误码 | 错误码取值                                              | 解决方案                                                     |
| :----- | :------------------------------------------------------ | :----------------------------------------------------------- |
| 40001  | invalid credential access_token isinvalid or not latest | 获取 access_token 时 AppSecret 错误,或者 access_token 无效。请开发者认真比对 AppSecret 的正确性,或查看是否正在为恰当的公众号调用接口 |