itecdn 5.x / 用户 API
获取当前用户信息
GET
/v1/user获取当前登录用户的账户资料、实名认证与企业认证状态、二次认证设置、余额和用户组。身份证姓名和号码会脱敏后返回。未登录时不能访问。
身份认证
access-token
api-key + api-secret
认证定义
{
"AccessToken": {
"type": "apiKey",
"in": "header",
"name": "access-token",
"description": "通过登录接口获得的短期访问令牌。"
},
"ApiKey": {
"type": "apiKey",
"in": "header",
"name": "api-key",
"description": "API Key;必须和 api-secret 同时发送。"
},
"ApiSecret": {
"type": "apiKey",
"in": "header",
"name": "api-secret",
"description": "API Secret;必须和 api-key 同时发送。"
}
}请求参数
未定义路径、查询或请求头参数。
响应
HTTP 200
请求已被处理。成功时 code 为 0、msg 为“获取成功!”、data 为当前用户资料;未登录时仍返回 HTTP 200。
application/json
object
| 字段 | 类型 | 必填 | 说明与约束 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
code | integer | 必填 | 业务状态码;成功为 0。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
msg | string | 必填 | 处理结果说明。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data | object | 必填 | 当前登录用户资料。 约束 / 默认值 / 示例展开字段结构当前登录用户资料。
|
完整 Schema
{
"type": "object",
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "integer",
"description": "业务状态码;成功为 0。",
"example": 0
},
"msg": {
"type": "string",
"description": "处理结果说明。",
"example": "获取成功!"
},
"data": {
"type": "object",
"description": "当前登录用户资料。",
"required": [
"id",
"name",
"balance",
"cert_verified"
],
"properties": {
"id": {
"type": "integer",
"description": "用户 ID。"
},
"name": {
"type": "string",
"description": "用户名。"
},
"email": {
"type": "string",
"nullable": true,
"description": "邮箱地址。"
},
"phone": {
"type": "string",
"nullable": true,
"description": "手机号。"
},
"qq": {
"type": "string",
"nullable": true,
"description": "QQ 号。"
},
"balance": {
"type": "number",
"description": "账户余额。"
},
"create_at": {
"type": "string",
"description": "注册时间,格式为 YYYY-MM-DD HH:mm:ss。"
},
"user_group": {
"type": "integer",
"nullable": true,
"description": "用户组 ID。"
},
"group_name": {
"type": "string",
"nullable": true,
"description": "用户组名称。"
},
"cert_id": {
"type": "integer",
"nullable": true,
"description": "实名认证证书 ID。"
},
"cert_name": {
"type": "string",
"description": "脱敏后的实名姓名。"
},
"cert_no": {
"type": "string",
"description": "脱敏后的证件号码。"
},
"cert_verified": {
"type": "integer",
"enum": [
0,
1
],
"description": "个人实名认证状态。"
},
"id_auth_way": {
"type": "string",
"nullable": true,
"description": "实名认证方式。"
},
"company_auth_enable": {
"type": "integer",
"enum": [
0,
1
],
"description": "系统是否启用企业认证。"
},
"company_name": {
"type": "string",
"nullable": true,
"description": "企业名称。"
},
"company_credit_code": {
"type": "string",
"nullable": true,
"description": "统一社会信用代码。"
},
"company_verified": {
"type": "integer",
"enum": [
0,
1
],
"description": "企业认证状态。"
},
"auth2_enable": {
"type": "integer",
"enum": [
0,
1
],
"description": "是否启用二次认证。"
},
"auth2_verified": {
"type": "integer",
"enum": [
0,
1
],
"description": "当前二次认证是否已验证。"
},
"auth2_end_at": {
"type": "string",
"nullable": true,
"description": "二次认证有效截止时间。"
},
"auth2_expire_action": {
"type": "string",
"description": "二次认证过期处理动作。"
},
"login_captcha": {
"type": "string",
"nullable": true,
"description": "登录二次验证方式。"
},
"white_ip": {
"type": "string",
"nullable": true,
"description": "登录 IP 白名单。"
}
}
}
}
}示例
{
"code": 0,
"msg": "获取成功!",
"data": {
"id": 12,
"name": "demo",
"email": "demo@example.invalid",
"phone": "138****0000",
"balance": 100.5,
"cert_name": "张*",
"cert_no": "1****************8",
"cert_verified": 1,
"company_auth_enable": 1,
"company_verified": 0,
"auth2_enable": 0,
"auth2_verified": 0
}
}获取成功
{
"code": 0,
"msg": "获取成功!",
"data": {
"id": 12,
"name": "demo",
"email": "demo@example.invalid",
"phone": "138****0000",
"balance": 100.5,
"cert_name": "张*",
"cert_no": "1****************8",
"cert_verified": 1,
"company_auth_enable": 1,
"company_verified": 0,
"auth2_enable": 0,
"auth2_verified": 0
}
}未登录
{
"code": "user-48",
"msg": "请登录",
"data": ""
}cURL 示例
根据文档生成;请替换主控地址、路径参数和凭证,并按上表补充查询参数。
curl --request GET \
"https://master.example.invalid/v1/user" \
--header "access-token: YOUR_ACCESS_TOKEN"