itecdn 5.x用户文档
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

字段类型必填说明与约束
codeinteger必填

业务状态码;成功为 0。

约束 / 默认值 / 示例
{
  "example": 0
}
msgstring必填

处理结果说明。

约束 / 默认值 / 示例
{
  "example": "获取成功!"
}
dataobject必填

当前登录用户资料。

约束 / 默认值 / 示例
{
  "required": [
    "id",
    "name",
    "balance",
    "cert_verified"
  ]
}
展开字段结构

当前登录用户资料。

字段类型必填说明与约束
idinteger必填

用户 ID。

namestring必填

用户名。

emailstring可选

邮箱地址。

约束 / 默认值 / 示例
{
  "nullable": true
}
phonestring可选

手机号。

约束 / 默认值 / 示例
{
  "nullable": true
}
qqstring可选

QQ 号。

约束 / 默认值 / 示例
{
  "nullable": true
}
balancenumber必填

账户余额。

create_atstring可选

注册时间,格式为 YYYY-MM-DD HH:mm:ss。

user_groupinteger可选

用户组 ID。

约束 / 默认值 / 示例
{
  "nullable": true
}
group_namestring可选

用户组名称。

约束 / 默认值 / 示例
{
  "nullable": true
}
cert_idinteger可选

实名认证证书 ID。

约束 / 默认值 / 示例
{
  "nullable": true
}
cert_namestring可选

脱敏后的实名姓名。

cert_nostring可选

脱敏后的证件号码。

cert_verifiedinteger必填

个人实名认证状态。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ]
}
id_auth_waystring可选

实名认证方式。

约束 / 默认值 / 示例
{
  "nullable": true
}
company_auth_enableinteger可选

系统是否启用企业认证。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ]
}
company_namestring可选

企业名称。

约束 / 默认值 / 示例
{
  "nullable": true
}
company_credit_codestring可选

统一社会信用代码。

约束 / 默认值 / 示例
{
  "nullable": true
}
company_verifiedinteger可选

企业认证状态。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ]
}
auth2_enableinteger可选

是否启用二次认证。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ]
}
auth2_verifiedinteger可选

当前二次认证是否已验证。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ]
}
auth2_end_atstring可选

二次认证有效截止时间。

约束 / 默认值 / 示例
{
  "nullable": true
}
auth2_expire_actionstring可选

二次认证过期处理动作。

login_captchastring可选

登录二次验证方式。

约束 / 默认值 / 示例
{
  "nullable": true
}
white_ipstring可选

登录 IP 白名单。

约束 / 默认值 / 示例
{
  "nullable": true
}
完整 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"

查看完整接口 JSON