# 认证模块 - 客户端用户登录

> 模块标识：auth  |  接口数量：4

## 接口说明
**方法**：	POST

**路径**：				/auth/client/login

**功能说明**：
客户端用户登录接口。如果用户有多个可用站点，会返回站点列表供前端选择。

### 请求参数
```json
{
  "headers": [
    {
      "name": "system",
      "type": "string",
      "required": false,
      "description": "系统编码，登录时自动分配系统默认管理员角色"
    }
  ],
  "body": {
    "phone": "string｜必填，手机号",
    "password": "string｜必填，登录密码",
    "agreeTerms": "boolean｜必填，是否同意协议"
  }
}
```

### 响应示例
```json
{
  "success": {
    "code": "0000",
    "message": "登录成功",
    "data": {
      "token": "jwt-token",
      "user": {
        "id": "CU0001",
        "code": "CU000001",
        "username": "客户端管理员",
        "phone": "13800138000",
        "email": "client@example.com",
        "individualism": true,
        "individualDbName": "client_user_1_1764407777204",
        "status": 1,
        "createTime": "2025-01-21T10:00:00.000Z",
        "accountType": "clientUser",
        "type": "散客"
      },
      "availableSites": [
        {
          "siteKey": "56B57A72-59C4-460B-82E5-22196205391B-A4608B6E9D4D6F599",
          "name": "所属站点",
          "type": "owner",
          "isDefault": true
        },
        {
          "siteKey": "A1B2C3D4-E5F6-7890-ABCD-EF1234567890-ABCDEF12",
          "name": "个人站点",
          "type": "personal",
          "isDefault": false
        }
      ]
    }
  },
  "failure": {
    "code": "4000",
    "message": "登录失败",
    "data": null
  }
}
```

### 注意事项
- 如果用户有独立站点，availableSites 会包含两个站点：所属站点（type: owner）和个人站点（type: personal）
- 前端可以通过 X-Site header 切换站点，切换后所有 API 请求将使用对应站点的数据库
- 默认使用所属站点（isDefault: true），如需切换到个人站点，在后续请求中传递个人站点的 siteKey

