> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aihairstyle.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 学分查询 API

> AI发型设计 API - 学分查询 API 文档和使用指南。

export const baseUrl = 'https://api.aihairstyle.cn';

## 请求

* **URL**: {baseUrl}/common/query-credits
* **方法**: `GET`

### 请求头

| 字段                 | 必填 | 类型       | 描述                                               |
| :----------------- | :- | :------- | :----------------------------------------------- |
| `ailabapi-api-key` | 是  | `String` | 应用 API KEY。 [获取 API KEY](/common/authentication) |

## 响应

**响应字段处理流程**

1. **处理`公共响应字段`**

   解析并验证`公共响应字段`，检查状态码或响应消息以确保请求成功且无错误。

2. **处理`业务响应字段`**

   如果`公共响应字段`有效且无错误，则继续处理`业务响应字段`中的业务逻辑。

### 公共响应字段

<a href="/essentials/response-description" target="_blank">查看公共响应字段和错误代码</a>

### 业务响应字段

| 字段                       | 类型        | 范围 | 描述        |    |
| :----------------------- | :-------- | :- | :-------- | -- |
| `data`                   | `array`   |    | 数据数组      |    |
| +`name`                  | `string`  |    | 名称。       | \\ |
| +`balance`               | `float`   |    | 积分余额。     | \\ |
| +`total`                 | `float`   |    | 总积分。      | \\ |
| +`last_recharge_balance` | `float`   |    | 上次购买后的余额。 | \\ |
| +`balance_warning`       | `float`   |    | 积分余额预警值。  | \\ |
| +`first_buy_time`        | `integer` |    | 首次购买时间。   | \\ |
| +`last_update_time`      | `integer` |    | 最后更新时间。   | \\ |

### 响应示例

```json theme={null}
{
  "error_code":     0,
  "error_msg":      "",
  "error_detail":   {
    "status_code":  200,
    "code":         "",
    "code_message": "",
    "message":      ""
  },
  "data":           [
    {
      "unique_sign":           "",
      "name":                  "",
      "balance":               0,\
      "total":                 0,
      "last_recharge_balance": 0,
      "balance_warning":       0,
      "first_buy_time":        0,
      "last_update_time":      0
    }
  ]
}
```


## OpenAPI

````yaml GET /common/query-credits
openapi: 3.0.0
info:
  title: AI发型设计 API
  description: AI发型设计 提供简单灵活的 API 端点，满足您的 AI 需求
  version: 1.0.0
  contact:
    name: AI发型设计 Support
servers:
  - url: https://api.aihairstyle.cn
    description: Production server
security: []
paths:
  /common/query-credits:
    parameters: []
    get:
      tags:
        - Common
      summary: Querying credits
      description: Querying credits
      parameters: []
      responses:
        default:
          headers:
            Content-Type:
              schema:
                type: string
              example: application/json
          description: Querying credits
          content:
            application/json:
              schema:
                type: object
                properties:
                  error_code:
                    type: integer
                  error_code_str:
                    type: string
                  error_msg:
                    type: string
                  error_detail:
                    type: object
                    properties:
                      status_code:
                        type: integer
                      code:
                        type: string
                      code_message:
                        type: string
                      message:
                        type: string
                  data:
                    type: object
                    properties:
                      unique_sign:
                        type: string
                      name:
                        type: string
                      balance:
                        type: integer
                      total:
                        type: integer
                      last_recharge_balance:
                        type: integer
                      balance_warning:
                        type: integer
                      first_buy_time:
                        type: integer
                      last_update_time:
                        type: integer
              example:
                error_code: 0
                error_code_str: ''
                error_msg: ''
                error_detail:
                  status_code: 200
                  code: ''
                  code_message: ''
                  message: ''
                data:
                  unique_sign: ''
                  name: ''
                  balance: 0
                  total: 0
                  last_recharge_balance: 0
                  balance_warning: 0
                  first_buy_time: 0
                  last_update_time: 0
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: ailabapi-api-key
      description: API Key for authentication

````