运维中心 /getFeedback

# operation.getFeedback

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

获取用户反馈列表。获取图片实体请参考接口 [getFeedbackmedia](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/operation/operation.getFeedbackmedia.html)

调用方式:

- [HTTPS 调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/operation/operation.getFeedback.html#method-http)
- [云调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/operation/operation.getFeedback.html#method-cloud)



## HTTPS 调用

### 请求地址

```text
GET https://api.weixin.qq.com/wxaapi/feedback/list?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                                  | number |        | 否   | 反馈的类型,默认拉取全部类型,详细定义见下面                 |
| page                                  | number |        | 是   | 分页的页数,从1开始                                          |
| num                                   | number |        | 是   | 分页拉取的数据数量                                           |

### 请求示例

```json
{
  "page":1,
  "num":10
}
```

### 返回的 JSON 数据包

| 属性      | 类型           | 说明     |
| :-------- | :------------- | :------- |
| errcode   | number         | 错误码   |
| errmsg    | string         | 错误信息 |
| list      | Array.<Object> | 反馈列表 |
| total_num | number         | 总条数   |

### 反馈类型 type 的定义

| 值   | 说明           |
| :--- | :------------- |
| 1    | 无法打开小程序 |
| 2    | 小程序闪退     |
| 3    | 卡顿           |
| 4    | 黑屏白屏       |
| 5    | 死机           |
| 6    | 界面错位       |
| 7    | 界面加载慢     |
| 8    | 其他异常       |

### 响应示例

```json
{
  "list": [
      {
          "record_id": 1,
          "create_time": 1587571200,
          "content": "白屏了",
          "phone": 18800000000,
          "openid": "openidxxxxxx",
          "nickname": "反馈用户昵称",
          "head_url": "反馈用户头像",
          "type": 1,
          "mediaIds": [],
          "systemInfo": "{}"
      }
  ],
  "total_num": 100,
  "errcode": 0
}
```



## 云调用

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

### 接口方法

```js
openapi.operation.getFeedback
```

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

### 请求参数

| 属性 | 类型   | 默认值 | 必填 | 说明                                         |
| :--- | :----- | :----- | :--- | :------------------------------------------- |
| type | number |        | 否   | 反馈的类型,默认拉取全部类型,详细定义见下面 |
| page | number |        | 是   | 分页的页数,从1开始                          |
| num  | number |        | 是   | 分页拉取的数据数量                           |

### 请求示例

```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.operation.getFeedback({
        "type": '',
        "page": '',
        "num": ''
      })
    return result
  } catch (err) {
    return err
  }
}
```

### 请求示例

```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.operation.getFeedback({
        "page": 1,
        "num": 10
      })
    return result
  } catch (err) {
    return err
  }
}
```

### 响应示例

```json
const cloud = require('wx-server-sdk')
cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.operation.getFeedback({
        "list": [
          {
            "content": '白屏了',
            "phone": 18800000000,
            "openid": 'openidxxxxxx',
            "nickname": '反馈用户昵称',
            "type": 1,
            "mediaIds": [],
            "systemInfo": '{}',
            "recordId": 1,
            "createTime": 1587571200,
            "headUrl": '反馈用户头像'
          }
        ],
        "errcode": 0,
        "totalNum": 100
      })
    return result
  } catch (err) {
    return err
  }
}
```