# 异步任务查询

## 功能说明

通过一个 task_id，查询该任务的执行状态。

## 请求 uri

`/v2/async/fetch`

## 请求类型

`POST`

## 请求参数

### params

| 字段名    | 类型   | 必填 | 描述    |
| --------- | ------ | ---- | ------- |
| `task_id` | string | 是   | 任务 ID |

## 返回参数

| 字段名                    | 类型   | 含义                                    |
| ------------------------- | ------ | --------------------------------------- |
| `data.state`              | int    | 1 进行中， 2 成功， 3 失败              |
| `data.msg`                | string | 错误信息                                |
| `data.progress`           | int    | 进度,百分比                             |
| `data.start`              | int64  | 任务开始时间                            |
| `data.end`                | int64  | 任务结束时间                            |
| `data.url`                | string | 导出任务的下载链接                      |
| `data.success_skill_info` | map    | 导入 bot 时候成功的技能名字和 ID 映射表 |

## 示例

- 请求示例

```bash
curl 'https://openaiapi.weixin.qq.com/v2/async/fetch' \
-H 'X-APPID: 57qpmftpwmqS4a2' \
-H 'request_id: 59704fde-98d2-47bc-acb9-23ac31cf82b0' \
-H 'timestamp: 1711520394' \
-H 'nonce: abcdefghijklmn' \
-H 'sign: 通过sign=md5(Token+str(unix_timestamp)+nonce+md5(body))生成' \
-H 'X-OPENAI-TOKEN: OgYcTrHYDS0YAMgTwC@9FEvF+svDpKwC6603c143e45fa' \
-H 'content-type: application/json' \
-d '{"task_id":"fad7576d7562429d9c5d8568dc35a41b"}'
```

- 正确返回示例

```json
{
  "code": 0,
  "data": {
    "end": 1711088874,
    "fail_count": 0,
    "fail_skill_info": null,
    "import_export_time": null,
    "msg": "",
    "progress": 100,
    "replace_count": 0,
    "start": 1711088873,
    "state": 2,
    "success_count": 1,
    "success_skill_info": [
      {
        "id": 2098207,
        "intents": [
          {
            "id": 47147532,
            "name": "BBC"
          }
        ],
        "name": "AAA"
      }
    ],
    "success_upload_count": 0,
    "total_count": 1,
    "url": ""
  },
  "msg": "success",
  "request_id": "test123"
}
```

- 错误返回示例

```json
{
  "code": 210202,
  "data": null,
  "msg": "权限不足"
}
```
