{ "schemes": [ "http", "https" ], "swagger": "2.0", "info": { "description": "API for user management, authentication, authorization, and administration.", "title": "User Management System API", "contact": {}, "version": "1.0" }, "basePath": "/api/v1", "paths": { "/api/v1/admin/admins": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取所有管理员用户列表(仅管理员)", "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取管理员列表", "responses": { "200": { "description": "管理员列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/handler.UserResponse" } } } } ] } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "创建新管理员账号(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "创建管理员", "parameters": [ { "description": "管理员信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.CreateAdminRequest" } } ], "responses": { "201": { "description": "管理员创建成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.UserResponse" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/admin/admins/{id}": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "删除管理员角色(最后管理员保护、自删保护)(仅管理员)", "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "删除管理员", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "管理员已移除", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "无效的用户ID", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "409": { "description": "无法删除(最后管理员或自删)", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/admin/devices": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取所有设备列表(仅管理员),支持游标分页和偏移分页", "produces": [ "application/json" ], "tags": [ "设备管理" ], "summary": "获取所有设备列表", "parameters": [ { "type": "string", "description": "游标分页游标", "name": "cursor", "in": "query" }, { "type": "integer", "description": "每页数量(游标模式)", "name": "size", "in": "query" }, { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "设备列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.DeviceListResponse" } } } ] } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/admin/settings": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取系统配置、安全设置和功能开关信息", "produces": [ "application/json" ], "tags": [ "系统设置" ], "summary": "获取系统设置", "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service.SystemSettings" } } } ] } } } } }, "/api/v1/admin/stats/dashboard": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取系统仪表盘统计数据(仅管理员)", "produces": [ "application/json" ], "tags": [ "统计" ], "summary": "获取仪表盘统计", "responses": { "200": { "description": "仪表盘数据", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service.DashboardStats" } } } ] } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/admin/stats/users": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取用户统计数据(仅管理员)", "produces": [ "application/json" ], "tags": [ "统计" ], "summary": "获取用户统计", "responses": { "200": { "description": "用户统计数据", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service.UserStats" } } } ] } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/admin/users/export": { "get": { "security": [ { "BearerAuth": [] } ], "description": "导出用户数据为 CSV 或 Excel 格式", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "数据导入导出" ], "summary": "导出用户数据", "parameters": [ { "enum": [ "csv", "excel" ], "type": "string", "default": "csv", "description": "导出格式", "name": "format", "in": "query" }, { "type": "string", "description": "导出字段,逗号分隔", "name": "fields", "in": "query" }, { "type": "string", "description": "关键词过滤", "name": "keyword", "in": "query" }, { "type": "integer", "description": "用户状态过滤", "name": "status", "in": "query" } ], "responses": { "200": { "description": "用户数据文件", "schema": { "type": "file" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/admin/users/import": { "post": { "security": [ { "BearerAuth": [] } ], "description": "从 CSV 或 Excel 文件导入用户数据", "consumes": [ "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ "数据导入导出" ], "summary": "导入用户数据", "parameters": [ { "type": "file", "description": "导入文件", "name": "file", "in": "formData", "required": true }, { "enum": [ "csv", "excel" ], "type": "string", "default": "csv", "description": "文件格式", "name": "format", "in": "query" } ], "responses": { "200": { "description": "导入结果", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/admin/users/import/template": { "get": { "security": [ { "BearerAuth": [] } ], "description": "下载用户批量导入的 CSV 或 Excel 模板", "produces": [ "application/json" ], "tags": [ "数据导入导出" ], "summary": "获取用户导入模板", "parameters": [ { "enum": [ "csv", "excel" ], "type": "string", "default": "csv", "description": "模板格式", "name": "format", "in": "query" } ], "responses": { "200": { "description": "导入模板文件", "schema": { "type": "file" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/2fa/disable": { "post": { "security": [ { "BearerAuth": [] } ], "description": "输入验证码禁用 TOTP 两步验证", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "两步验证" ], "summary": "禁用 TOTP 两步验证", "parameters": [ { "description": "验证码", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.DisableTOTPRequest" } } ], "responses": { "200": { "description": "禁用成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证或验证码错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/2fa/enable": { "post": { "security": [ { "BearerAuth": [] } ], "description": "输入验证码启用 TOTP 两步验证", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "两步验证" ], "summary": "启用 TOTP 两步验证", "parameters": [ { "description": "验证码", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.EnableTOTPRequest" } } ], "responses": { "200": { "description": "启用成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证或验证码错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/2fa/setup": { "get": { "security": [ { "BearerAuth": [] } ], "description": "为当前用户设置 TOTP 两步验证,返回密钥和二维码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "两步验证" ], "summary": "设置 TOTP 两步验证", "responses": { "200": { "description": "TOTP设置信息", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.TOTPSetupResponse" } } } ] } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/2fa/status": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户的TOTP两步验证状态", "produces": [ "application/json" ], "tags": [ "两步验证" ], "summary": "获取TOTP状态", "responses": { "200": { "description": "TOTP状态", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.TOTPStatusResponse" } } } ] } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/2fa/verify": { "post": { "security": [ { "BearerAuth": [] } ], "description": "在登录或其他敏感操作时验证 TOTP 验证码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "两步验证" ], "summary": "验证 TOTP 验证码", "parameters": [ { "description": "验证码", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.VerifyTOTPRequest" } } ], "responses": { "200": { "description": "验证结果", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.VerifyTOTPResponse" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证或验证码错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/activate-email": { "post": { "description": "使用邮箱激活token激活用户账号", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "邮箱认证" ], "summary": "激活用户邮箱", "parameters": [ { "description": "激活请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.ActivateEmailRequest" } } ], "responses": { "200": { "description": "激活成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "token缺失", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "token无效或已过期", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/bootstrap-admin": { "post": { "security": [ { "BootstrapSecret": [] } ], "description": "在系统未配置管理员时,创建第一个管理员账号(需要BOOTSTRAP_SECRET)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统初始化" ], "summary": "引导初始化管理员账号", "parameters": [ { "type": "string", "description": "引导密钥", "name": "X-Bootstrap-Secret", "in": "header", "required": true }, { "description": "管理员信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.BootstrapAdminRequest" } } ], "responses": { "201": { "description": "管理员创建成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service.UserInfo" } } } ] } }, "401": { "description": "引导密钥无效", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "引导初始化未授权", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/capabilities": { "get": { "description": "返回系统支持的认证方式和配置(如是否需要邮件激活、是否支持OAuth等)", "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "获取系统认证能力", "responses": { "200": { "description": "认证能力配置", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service.AuthCapabilities" } } } ] } } } } }, "/api/v1/auth/captcha": { "get": { "description": "生成图形验证码", "produces": [ "application/json" ], "tags": [ "验证码" ], "summary": "生成验证码", "responses": { "200": { "description": "验证码信息", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.CaptchaResponse" } } } ] } } } } }, "/api/v1/auth/captcha/image": { "get": { "description": "根据captcha_id获取验证码图片(当前未实现)", "produces": [ "application/json" ], "tags": [ "验证码" ], "summary": "获取验证码图片", "parameters": [ { "type": "string", "description": "验证码ID", "name": "captcha_id", "in": "query" } ], "responses": { "200": { "description": "验证码图片", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/captcha/verify": { "post": { "description": "验证用户输入的验证码是否正确", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "验证码" ], "summary": "验证验证码", "parameters": [ { "description": "验证码信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.VerifyCaptchaRequest" } } ], "responses": { "200": { "description": "验证成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.VerifyResponse" } } } ] } }, "400": { "description": "验证码无效", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/csrf-token": { "get": { "description": "由于系统使用JWT Bearer Token认证,不存在CSRF风险,返回空token", "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "获取CSRF令牌", "responses": { "200": { "description": "CSRF token(为空)", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.CSRFTokenResponse" } } } ] } } } } }, "/api/v1/auth/forgot-password": { "post": { "description": "请求密码重置邮件", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "密码重置" ], "summary": "忘记密码", "parameters": [ { "description": "邮箱地址", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.ForgotPasswordRequest" } } ], "responses": { "200": { "description": "密码重置邮件已发送", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/forgot-password/phone": { "post": { "description": "向绑定的手机号发送短信验证码用于重置密码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "密码重置" ], "summary": "发送短信验证码(忘记密码)", "parameters": [ { "description": "手机号", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.ForgotPasswordByPhoneRequest" } } ], "responses": { "200": { "description": "验证码发送成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "503": { "description": "短信服务未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/login": { "post": { "description": "用户使用账号密码登录,支持多种认证方式(用户名/邮箱/手机号)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "用户登录", "parameters": [ { "description": "登录请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.LoginRequest" } } ], "responses": { "200": { "description": "登录成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service.LoginResponse" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } } ] } }, "401": { "description": "认证失败", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } } ] } }, "429": { "description": "登录尝试过多", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } } ] } } } } }, "/api/v1/auth/login/code": { "post": { "description": "使用手机号和短信验证码登录(带设备信息以支持设备信任链路)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "短信验证" ], "summary": "短信验证码登录", "parameters": [ { "description": "登录请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.SMSLoginRequest" } } ], "responses": { "200": { "description": "登录成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "验证码错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "503": { "description": "短信登录未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/login/email-code": { "post": { "description": "使用邮箱和验证码完成登录", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "邮箱认证" ], "summary": "邮箱验证码登录", "parameters": [ { "description": "登录请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.LoginByEmailCodeRequest" } } ], "responses": { "200": { "description": "登录成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service.LoginResponse" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "验证码错误或已过期", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/login/totp-verify": { "post": { "description": "当登录返回requires_totp=true时,使用此接口完成TOTP验证", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "TOTP验证(密码登录后)", "parameters": [ { "description": "TOTP验证请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.TOTPVerifyRequest" } } ], "responses": { "200": { "description": "验证成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service.LoginResponse" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "TOTP验证失败", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/logout": { "post": { "security": [ { "BearerAuth": [] } ], "description": "使当前 access_token 和 refresh_token 失效", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "用户登出", "parameters": [ { "description": "登出请求(token可从header获取)", "name": "request", "in": "body", "schema": { "$ref": "#/definitions/service.LogoutRequest" } } ], "responses": { "200": { "description": "登出成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } } ] } } } } }, "/api/v1/auth/oauth/exchange": { "post": { "description": "使用OAuth code交换access_token(当前未配置)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "OAuth" ], "summary": "OAuth令牌交换", "parameters": [ { "type": "string", "description": "OAuth提供商", "name": "provider", "in": "path", "required": true } ], "responses": { "200": { "description": "OAuth未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/oauth/providers": { "get": { "description": "返回系统已配置并启用的OAuth提供商列表", "produces": [ "application/json" ], "tags": [ "OAuth" ], "summary": "获取OAuth提供商列表", "responses": { "200": { "description": "提供商列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.OAuthProvidersResponse" } } } ] } } } } }, "/api/v1/auth/oauth/{provider}": { "get": { "description": "发起OAuth登录流程(当前未配置)", "produces": [ "application/json" ], "tags": [ "OAuth" ], "summary": "OAuth登录初始化", "parameters": [ { "type": "string", "description": "OAuth提供商(如 github, google)", "name": "provider", "in": "path", "required": true } ], "responses": { "200": { "description": "OAuth未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/oauth/{provider}/callback": { "get": { "description": "处理OAuth provider回调(当前未配置)", "produces": [ "application/json" ], "tags": [ "OAuth" ], "summary": "OAuth回调处理", "parameters": [ { "type": "string", "description": "OAuth提供商", "name": "provider", "in": "path", "required": true } ], "responses": { "200": { "description": "OAuth未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/password/validate": { "post": { "description": "验证密码重置链接中的 Token 是否有效", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "密码重置" ], "summary": "验证密码重置 Token", "parameters": [ { "description": "重置 Token", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.ValidateResetTokenRequest" } } ], "responses": { "200": { "description": "Token验证结果", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.ValidateTokenResponse" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/refresh": { "post": { "description": "使用 refresh_token 获取新的 access_token", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "刷新访问令牌", "parameters": [ { "description": "刷新令牌请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.RefreshTokenRequest" } } ], "responses": { "200": { "description": "刷新成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service.LoginResponse" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } } ] } }, "401": { "description": "refresh_token无效或已过期", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } } ] } } } } }, "/api/v1/auth/register": { "post": { "description": "用户注册新账号,支持用户名+密码或手机号注册", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "用户注册", "parameters": [ { "description": "注册请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.RegisterRequest" } } ], "responses": { "201": { "description": "注册成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service.UserInfo" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } } ] } }, "409": { "description": "用户已存在", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } } ] } } } } }, "/api/v1/auth/resend-activation": { "post": { "description": "重新发送账号激活邮件(防枚举:无论邮箱是否注册都返回成功)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "邮箱认证" ], "summary": "重发激活邮件", "parameters": [ { "description": "邮箱地址", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.ResendActivationRequest" } } ], "responses": { "200": { "description": "激活邮件已发送(如果邮箱已注册)", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "邮箱格式错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/reset-password": { "post": { "description": "使用 Token 重置密码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "密码重置" ], "summary": "重置密码", "parameters": [ { "description": "重置请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.ResetPasswordRequest" } } ], "responses": { "200": { "description": "密码重置成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/reset-password/phone": { "post": { "description": "使用短信验证码重置登录密码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "密码重置" ], "summary": "通过短信验证码重置密码", "parameters": [ { "description": "重置请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.ResetPasswordByPhoneRequest" } } ], "responses": { "200": { "description": "密码重置成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "验证码错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "503": { "description": "短信服务未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/send-code": { "post": { "description": "向指定手机号发送短信验证码(用于注册或登录)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "短信验证" ], "summary": "发送短信验证码", "parameters": [ { "description": "发送验证码请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.SendCodeRequest" } } ], "responses": { "200": { "description": "发送成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "503": { "description": "短信服务未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/send-email-code": { "post": { "description": "发送邮箱登录验证码(防枚举:无论邮箱是否注册都返回成功)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "邮箱认证" ], "summary": "发送邮箱验证码", "parameters": [ { "description": "邮箱地址", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.SendEmailCodeRequest" } } ], "responses": { "200": { "description": "验证码已发送", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "邮箱格式错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/auth/userinfo": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取已登录用户的详细信息", "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "获取当前用户信息", "responses": { "200": { "description": "用户信息", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service.UserInfo" } } } ] } }, "401": { "description": "未认证", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } } ] } } } } }, "/api/v1/custom-fields": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取所有自定义字段定义列表", "produces": [ "application/json" ], "tags": [ "自定义字段" ], "summary": "获取自定义字段列表", "responses": { "200": { "description": "字段列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/handler.SwaggerCustomField" } } } } ] } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "创建新的自定义字段定义(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "自定义字段" ], "summary": "创建自定义字段", "parameters": [ { "description": "字段定义", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.CreateFieldRequest" } } ], "responses": { "201": { "description": "创建成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerCustomField" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/custom-fields/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "根据ID获取自定义字段定义", "produces": [ "application/json" ], "tags": [ "自定义字段" ], "summary": "获取自定义字段详情", "parameters": [ { "type": "integer", "description": "字段ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "字段信息", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerCustomField" } } } ] } }, "404": { "description": "字段不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "更新自定义字段定义(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "自定义字段" ], "summary": "更新自定义字段", "parameters": [ { "type": "integer", "description": "字段ID", "name": "id", "in": "path", "required": true }, { "description": "更新信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.UpdateFieldRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerCustomField" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "字段不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "删除自定义字段定义(仅管理员)", "produces": [ "application/json" ], "tags": [ "自定义字段" ], "summary": "删除自定义字段", "parameters": [ { "type": "integer", "description": "字段ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "字段不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/devices": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户的所有设备记录", "produces": [ "application/json" ], "tags": [ "设备管理" ], "summary": "获取当前用户的设备列表", "parameters": [ { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "设备列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.DeviceListResponse" } } } ] } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "当前用户创建设备记录", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "设备管理" ], "summary": "创建设备记录", "parameters": [ { "description": "设备信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.CreateDeviceRequest" } } ], "responses": { "201": { "description": "设备创建成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerDevice" } } } ] } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/devices/by-device-id/{deviceId}/trust": { "post": { "security": [ { "BearerAuth": [] } ], "description": "根据设备唯一标识字符串设置设备为信任状态", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "设备管理" ], "summary": "根据设备标识设置信任", "parameters": [ { "type": "string", "description": "设备唯一标识", "name": "deviceId", "in": "path", "required": true }, { "description": "信任配置", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.TrustDeviceRequest" } } ], "responses": { "200": { "description": "设置成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/devices/me/logout-others": { "post": { "security": [ { "BearerAuth": [] } ], "description": "登出当前用户除指定设备外的所有其他设备", "produces": [ "application/json" ], "tags": [ "设备管理" ], "summary": "登出其他设备", "parameters": [ { "type": "string", "description": "当前设备ID", "name": "X-Device-ID", "in": "header", "required": true } ], "responses": { "200": { "description": "登出成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "无效的设备ID", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/devices/me/trusted": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户的信任设备列表", "produces": [ "application/json" ], "tags": [ "设备管理" ], "summary": "获取信任设备列表", "responses": { "200": { "description": "信任设备列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/handler.SwaggerDevice" } } } } ] } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/devices/users/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定用户的设备列表(仅本人或管理员)", "produces": [ "application/json" ], "tags": [ "设备管理" ], "summary": "获取用户设备列表", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "设备列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.DeviceListResponse" } } } ] } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/devices/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "根据ID获取设备详细信息", "produces": [ "application/json" ], "tags": [ "设备管理" ], "summary": "获取设备详情", "parameters": [ { "type": "integer", "description": "设备ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "设备信息", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerDevice" } } } ] } }, "404": { "description": "设备不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "更新设备的基本信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "设备管理" ], "summary": "更新设备信息", "parameters": [ { "type": "integer", "description": "设备ID", "name": "id", "in": "path", "required": true }, { "description": "更新信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.UpdateDeviceRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerDevice" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "设备不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "删除设备记录", "produces": [ "application/json" ], "tags": [ "设备管理" ], "summary": "删除设备", "parameters": [ { "type": "integer", "description": "设备ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "设备不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/devices/{id}/status": { "put": { "security": [ { "BearerAuth": [] } ], "description": "更新设备状态(active/inactive)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "设备管理" ], "summary": "更新设备状态", "parameters": [ { "type": "integer", "description": "设备ID", "name": "id", "in": "path", "required": true }, { "description": "状态信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.UpdateDeviceStatusRequest" } } ], "responses": { "200": { "description": "状态更新成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "无效的状态值", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "设备不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/devices/{id}/trust": { "post": { "security": [ { "BearerAuth": [] } ], "description": "将指定设备设置为信任设备,在信任期内免二次验证", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "设备管理" ], "summary": "设置设备为信任设备", "parameters": [ { "type": "integer", "description": "设备ID", "name": "id", "in": "path", "required": true }, { "description": "信任配置", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.TrustDeviceRequest" } } ], "responses": { "200": { "description": "设置成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "设备不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "取消设备的信任状态", "produces": [ "application/json" ], "tags": [ "设备管理" ], "summary": "取消设备信任", "parameters": [ { "type": "integer", "description": "设备ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "取消成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "设备不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/logs/login": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取所有登录日志(仅管理员),支持游标分页和偏移分页", "produces": [ "application/json" ], "tags": [ "日志" ], "summary": "获取登录日志列表", "parameters": [ { "type": "string", "description": "游标分页游标", "name": "cursor", "in": "query" }, { "type": "integer", "description": "每页数量(游标模式)", "name": "size", "in": "query" }, { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "登录日志列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.LoginLogListResponse" } } } ] } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/logs/login/export": { "get": { "security": [ { "BearerAuth": [] } ], "description": "导出登录日志为 CSV 文件", "produces": [ "application/json" ], "tags": [ "日志" ], "summary": "导出登录日志", "parameters": [ { "type": "string", "description": "开始时间", "name": "start_time", "in": "query" }, { "type": "string", "description": "结束时间", "name": "end_time", "in": "query" }, { "type": "integer", "format": "int64", "description": "用户ID", "name": "user_id", "in": "query" } ], "responses": { "200": { "description": "CSV文件", "schema": { "type": "file" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/logs/login/me": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户的登录日志", "produces": [ "application/json" ], "tags": [ "日志" ], "summary": "获取登录日志", "parameters": [ { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "登录日志列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.LoginLogListResponse" } } } ] } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/logs/operation": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取所有操作日志(仅管理员),支持游标分页和偏移分页", "produces": [ "application/json" ], "tags": [ "日志" ], "summary": "获取操作日志列表", "parameters": [ { "type": "string", "description": "游标分页游标", "name": "cursor", "in": "query" }, { "type": "integer", "description": "每页数量(游标模式)", "name": "size", "in": "query" }, { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "操作日志列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.OperationLogListResponse" } } } ] } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/logs/operation/me": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户的操作日志", "produces": [ "application/json" ], "tags": [ "日志" ], "summary": "获取操作日志", "parameters": [ { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "操作日志列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.OperationLogListResponse" } } } ] } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/permissions": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取系统权限列表", "produces": [ "application/json" ], "tags": [ "权限管理" ], "summary": "获取权限列表", "responses": { "200": { "description": "权限列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/handler.SwaggerPermission" } } } } ] } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "创建新的权限定义(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "权限管理" ], "summary": "创建权限", "parameters": [ { "description": "权限信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.CreatePermissionRequest" } } ], "responses": { "201": { "description": "创建成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerPermission" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/permissions/tree": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取系统权限的树形结构", "produces": [ "application/json" ], "tags": [ "权限管理" ], "summary": "获取权限树", "responses": { "200": { "description": "权限树", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/handler.SwaggerPermission" } } } } ] } } } } }, "/api/v1/permissions/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "根据ID获取权限详细信息", "produces": [ "application/json" ], "tags": [ "权限管理" ], "summary": "获取权限详情", "parameters": [ { "type": "integer", "description": "权限ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "权限信息", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerPermission" } } } ] } }, "404": { "description": "权限不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "更新权限信息(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "权限管理" ], "summary": "更新权限", "parameters": [ { "type": "integer", "description": "权限ID", "name": "id", "in": "path", "required": true }, { "description": "更新信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.UpdatePermissionRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerPermission" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "权限不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "删除权限定义(仅管理员)", "produces": [ "application/json" ], "tags": [ "权限管理" ], "summary": "删除权限", "parameters": [ { "type": "integer", "description": "权限ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "权限不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/permissions/{id}/status": { "put": { "security": [ { "BearerAuth": [] } ], "description": "更新权限状态(enabled/disabled)(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "权限管理" ], "summary": "更新权限状态", "parameters": [ { "type": "integer", "description": "权限ID", "name": "id", "in": "path", "required": true }, { "description": "状态信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.UpdatePermissionStatusRequest" } } ], "responses": { "200": { "description": "状态更新成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "无效的状态值", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "权限不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/roles": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取系统角色列表", "produces": [ "application/json" ], "tags": [ "角色管理" ], "summary": "获取角色列表", "responses": { "200": { "description": "角色列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.RoleListResponse" } } } ] } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "创建新角色(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "角色管理" ], "summary": "创建角色", "parameters": [ { "description": "角色信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.CreateRoleRequest" } } ], "responses": { "201": { "description": "角色创建成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerRole" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/roles/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "根据ID获取角色详细信息", "produces": [ "application/json" ], "tags": [ "角色管理" ], "summary": "获取角色详情", "parameters": [ { "type": "integer", "description": "角色ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "角色信息", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerRole" } } } ] } }, "404": { "description": "角色不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "更新角色信息(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "角色管理" ], "summary": "更新角色", "parameters": [ { "type": "integer", "description": "角色ID", "name": "id", "in": "path", "required": true }, { "description": "更新信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.UpdateRoleRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerRole" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "角色不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "删除角色(仅管理员)", "produces": [ "application/json" ], "tags": [ "角色管理" ], "summary": "删除角色", "parameters": [ { "type": "integer", "description": "角色ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "角色不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/roles/{id}/permissions": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取角色的权限列表", "produces": [ "application/json" ], "tags": [ "角色管理" ], "summary": "获取角色权限列表", "parameters": [ { "type": "integer", "description": "角色ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "权限列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/handler.SwaggerPermission" } } } } ] } }, "404": { "description": "角色不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "为角色分配权限(替换现有权限)(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "角色管理" ], "summary": "分配角色权限", "parameters": [ { "type": "integer", "description": "角色ID", "name": "id", "in": "path", "required": true }, { "description": "权限ID列表", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.AssignPermissionsRequest" } } ], "responses": { "200": { "description": "权限分配成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "角色不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/roles/{id}/status": { "put": { "security": [ { "BearerAuth": [] } ], "description": "更新角色状态(enabled/disabled)(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "角色管理" ], "summary": "更新角色状态", "parameters": [ { "type": "integer", "description": "角色ID", "name": "id", "in": "path", "required": true }, { "description": "状态信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.UpdateRoleStatusRequest" } } ], "responses": { "200": { "description": "状态更新成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "无效的状态值", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "角色不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/sso/authorize": { "get": { "security": [ { "BearerAuth": [] } ], "description": "处理 SSO 授权请求,返回授权码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "SSO" ], "summary": "SSO 授权", "parameters": [ { "type": "string", "description": "客户端ID", "name": "client_id", "in": "query", "required": true }, { "type": "string", "description": "回调地址", "name": "redirect_uri", "in": "query", "required": true }, { "enum": [ "code" ], "type": "string", "description": "响应类型", "name": "response_type", "in": "query", "required": true }, { "type": "string", "description": "授权范围", "name": "scope", "in": "query" }, { "type": "string", "description": "状态参数", "name": "state", "in": "query" } ], "responses": { "302": { "description": "重定向到回调地址", "schema": { "type": "string" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/sso/introspect": { "post": { "description": "验证 Access Token 的有效性并返回相关信息", "consumes": [ "application/x-www-form-urlencoded" ], "produces": [ "application/json" ], "tags": [ "SSO" ], "summary": "验证 Access Token", "parameters": [ { "type": "string", "description": "Access Token", "name": "token", "in": "formData", "required": true }, { "type": "string", "description": "客户端ID", "name": "client_id", "in": "formData", "required": true }, { "type": "string", "description": "客户端密钥", "name": "client_secret", "in": "formData", "required": true } ], "responses": { "200": { "description": "Token信息", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.IntrospectResponse" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "客户端认证失败", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/sso/revoke": { "post": { "description": "撤销指定的 Access Token", "consumes": [ "application/x-www-form-urlencoded" ], "produces": [ "application/json" ], "tags": [ "SSO" ], "summary": "撤销 Access Token", "parameters": [ { "type": "string", "description": "Access Token", "name": "token", "in": "formData", "required": true }, { "type": "string", "description": "客户端ID", "name": "client_id", "in": "formData", "required": true }, { "type": "string", "description": "客户端密钥", "name": "client_secret", "in": "formData", "required": true } ], "responses": { "200": { "description": "撤销成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "客户端认证失败", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/sso/token": { "post": { "description": "使用授权码获取 Access Token(授权码模式第二步)", "consumes": [ "application/x-www-form-urlencoded" ], "produces": [ "application/json" ], "tags": [ "SSO" ], "summary": "获取 Access Token", "parameters": [ { "enum": [ "authorization_code" ], "type": "string", "description": "授权类型", "name": "grant_type", "in": "formData", "required": true }, { "type": "string", "description": "授权码", "name": "code", "in": "formData", "required": true }, { "type": "string", "description": "回调地址", "name": "redirect_uri", "in": "formData", "required": true }, { "type": "string", "description": "客户端ID", "name": "client_id", "in": "formData", "required": true }, { "type": "string", "description": "客户端密钥", "name": "client_secret", "in": "formData", "required": true } ], "responses": { "200": { "description": "访问令牌响应", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.TokenResponse" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "客户端认证失败", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/sso/userinfo": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前通过 SSO Access Token 授权的用户信息", "produces": [ "application/json" ], "tags": [ "SSO" ], "summary": "获取 SSO 用户信息", "responses": { "200": { "description": "用户信息", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.UserInfoResponse" } } } ] } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/theme/active": { "get": { "description": "获取当前系统正在使用的主题(公开接口)", "produces": [ "application/json" ], "tags": [ "主题管理" ], "summary": "获取当前生效的主题", "responses": { "200": { "description": "当前生效主题", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerTheme" } } } ] } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/themes": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取所有主题(包括已禁用的)", "produces": [ "application/json" ], "tags": [ "主题管理" ], "summary": "获取所有主题", "responses": { "200": { "description": "主题列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/handler.SwaggerTheme" } } } } ] } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "创建新的主题配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "主题管理" ], "summary": "创建主题", "parameters": [ { "description": "主题信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.CreateThemeRequest" } } ], "responses": { "201": { "description": "主题创建成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerTheme" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/themes/default": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取系统默认主题", "produces": [ "application/json" ], "tags": [ "主题管理" ], "summary": "获取默认主题", "responses": { "200": { "description": "默认主题", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerTheme" } } } ] } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/themes/default/{id}": { "put": { "security": [ { "BearerAuth": [] } ], "description": "将指定主题设为系统默认主题", "produces": [ "application/json" ], "tags": [ "主题管理" ], "summary": "设置默认主题", "parameters": [ { "type": "integer", "description": "主题ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "设置成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/themes/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "根据ID获取主题详情", "produces": [ "application/json" ], "tags": [ "主题管理" ], "summary": "获取主题", "parameters": [ { "type": "integer", "description": "主题ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "主题详情", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerTheme" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "更新指定主题的配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "主题管理" ], "summary": "更新主题", "parameters": [ { "type": "integer", "description": "主题ID", "name": "id", "in": "path", "required": true }, { "description": "更新信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.UpdateThemeRequest" } } ], "responses": { "200": { "description": "主题更新成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.SwaggerTheme" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "删除指定的主题", "produces": [ "application/json" ], "tags": [ "主题管理" ], "summary": "删除主题", "parameters": [ { "type": "integer", "description": "主题ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "主题删除成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取用户列表,支持游标分页和偏移分页", "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取用户列表", "parameters": [ { "type": "string", "description": "游标分页游标", "name": "cursor", "in": "query" }, { "type": "integer", "description": "每页大小", "name": "size", "in": "query" }, { "type": "integer", "description": "偏移分页偏移量", "name": "offset", "in": "query" }, { "type": "integer", "description": "每页大小", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "用户列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.UserListResponse" } } } ] } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "创建新用户账号(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "创建用户", "parameters": [ { "description": "用户信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.CreateUserRequest" } } ], "responses": { "201": { "description": "用户创建成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.UserResponse" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/batch": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "批量删除多个用户(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "批量删除用户", "parameters": [ { "description": "批量删除请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.BatchDeleteRequest" } } ], "responses": { "200": { "description": "批量删除成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/batch/status": { "put": { "security": [ { "BearerAuth": [] } ], "description": "批量更新多个用户的状态(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "批量更新用户状态", "parameters": [ { "description": "批量更新请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.BatchUpdateStatusRequest" } } ], "responses": { "200": { "description": "批量更新成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/me/bind-email": { "post": { "description": "使用邮箱验证码绑定账号(当前未配置)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "邮箱绑定" ], "summary": "绑定邮箱", "responses": { "200": { "description": "功能未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "delete": { "description": "解绑账号关联的邮箱(当前未配置)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "邮箱绑定" ], "summary": "解绑邮箱", "responses": { "200": { "description": "功能未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/me/bind-email/code": { "post": { "description": "发送验证码到邮箱以绑定邮箱(当前未配置)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "邮箱绑定" ], "summary": "发送邮箱绑定验证码", "responses": { "200": { "description": "功能未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/me/bind-phone": { "post": { "description": "使用手机验证码绑定账号(当前未配置)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "手机绑定" ], "summary": "绑定手机号", "responses": { "200": { "description": "功能未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "delete": { "description": "解绑账号关联的手机号(当前未配置)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "手机绑定" ], "summary": "解绑手机号", "responses": { "200": { "description": "功能未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/me/bind-phone/code": { "post": { "description": "发送验证码到手机以绑定手机号(当前未配置)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "手机绑定" ], "summary": "发送手机绑定验证码", "responses": { "200": { "description": "功能未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/me/bind-social": { "post": { "description": "绑定第三方社交账号到当前用户(当前未配置)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "社交账号" ], "summary": "绑定社交账号", "responses": { "200": { "description": "功能未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/me/bind-social/{provider}": { "delete": { "description": "解绑当前用户关联的第三方社交账号(当前未配置)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "社交账号" ], "summary": "解绑社交账号", "responses": { "200": { "description": "功能未配置", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/me/custom-fields": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户的自定义字段值", "produces": [ "application/json" ], "tags": [ "自定义字段" ], "summary": "获取用户自定义字段值", "responses": { "200": { "description": "字段值", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.CustomFieldValuesResponse" } } } ] } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "设置当前用户的自定义字段值", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "自定义字段" ], "summary": "设置用户自定义字段值", "parameters": [ { "description": "字段值", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.SetUserFieldValuesRequest" } } ], "responses": { "200": { "description": "设置成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/me/social-accounts": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户绑定的第三方社交账号列表", "produces": [ "application/json" ], "tags": [ "社交账号" ], "summary": "获取已绑定的社交账号列表", "responses": { "200": { "description": "社交账号列表", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "根据ID获取用户详细信息", "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取用户详情", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "用户信息", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.UserResponse" } } } ] } }, "404": { "description": "用户不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "更新用户的基本信息(仅管理员或本人)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "更新用户信息", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true }, { "description": "更新信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.UpdateUserRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.UserResponse" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "用户不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "删除用户账号(仅管理员)", "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "删除用户", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "用户不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/{id}/avatar": { "post": { "security": [ { "BearerAuth": [] } ], "description": "上传并更新用户头像(仅本人或管理员)", "consumes": [ "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ "用户头像" ], "summary": "上传用户头像", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true }, { "type": "file", "description": "头像文件(最大5MB,支持jpg/jpeg/png/gif/webp)", "name": "avatar", "in": "formData", "required": true } ], "responses": { "200": { "description": "上传成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/handler.AvatarResponse" } } } ] } }, "400": { "description": "文件无效或大小超限", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "用户不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/{id}/password": { "put": { "security": [ { "BearerAuth": [] } ], "description": "修改用户密码(仅管理员或本人)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "修改用户密码", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true }, { "description": "密码信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.UpdatePasswordRequest" } } ], "responses": { "200": { "description": "密码修改成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "用户不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/{id}/roles": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定用户的角色列表(仅本人或管理员)", "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取用户角色列表", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "角色列表", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/handler.SwaggerRole" } } } } ] } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "用户不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "为用户分配角色(替换现有角色)(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "分配用户角色", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true }, { "description": "角色ID列表", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.AssignRolesRequest" } } ], "responses": { "200": { "description": "角色分配成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "用户不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/users/{id}/status": { "put": { "security": [ { "BearerAuth": [] } ], "description": "更新用户账号状态(active/inactive/locked/disabled)(仅管理员)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "更新用户状态", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true }, { "description": "状态信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.UpdateStatusRequest" } } ], "responses": { "200": { "description": "状态更新成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "无效的状态值", "schema": { "$ref": "#/definitions/handler.Response" } }, "403": { "description": "无权限", "schema": { "$ref": "#/definitions/handler.Response" } }, "404": { "description": "用户不存在", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/webhooks": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户的 Webhook 配置列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Webhook管理" ], "summary": "获取 Webhook 列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 20, "description": "每页数量", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "Webhook列表", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "创建新的 Webhook 配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Webhook管理" ], "summary": "创建 Webhook", "parameters": [ { "description": "Webhook信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.CreateWebhookRequest" } } ], "responses": { "201": { "description": "Webhook创建成功", "schema": { "allOf": [ { "$ref": "#/definitions/handler.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/domain.Webhook" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/webhooks/{id}": { "put": { "security": [ { "BearerAuth": [] } ], "description": "更新指定 Webhook 的配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Webhook管理" ], "summary": "更新 Webhook", "parameters": [ { "type": "integer", "description": "Webhook ID", "name": "id", "in": "path", "required": true }, { "description": "更新信息", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.UpdateWebhookRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "删除指定的 Webhook 配置", "produces": [ "application/json" ], "tags": [ "Webhook管理" ], "summary": "删除 Webhook", "parameters": [ { "type": "integer", "description": "Webhook ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } }, "/api/v1/webhooks/{id}/deliveries": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定 Webhook 的最近投递记录", "produces": [ "application/json" ], "tags": [ "Webhook管理" ], "summary": "获取 Webhook 投递记录", "parameters": [ { "type": "integer", "description": "Webhook ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "default": 20, "description": "返回记录数量", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "投递记录列表", "schema": { "$ref": "#/definitions/handler.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/handler.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/handler.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/handler.Response" } } } } } }, "definitions": { "auth.OAuthProvider": { "type": "string", "enum": [ "wechat", "qq", "weibo", "google", "facebook", "twitter", "github", "alipay", "douyin" ], "x-enum-varnames": [ "OAuthProviderWeChat", "OAuthProviderQQ", "OAuthProviderWeibo", "OAuthProviderGoogle", "OAuthProviderFacebook", "OAuthProviderTwitter", "OAuthProviderGitHub", "OAuthProviderAlipay", "OAuthProviderDouyin" ] }, "auth.OAuthProviderInfo": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "name": { "type": "string" }, "provider": { "$ref": "#/definitions/auth.OAuthProvider" } } }, "domain.UserStatus": { "type": "integer", "enum": [ 0, 1, 2, 3 ], "x-enum-comments": { "UserStatusActive": "已激活", "UserStatusDisabled": "已禁用", "UserStatusInactive": "未激活", "UserStatusLocked": "已锁定" }, "x-enum-descriptions": [ "未激活", "已激活", "已锁定", "已禁用" ], "x-enum-varnames": [ "UserStatusInactive", "UserStatusActive", "UserStatusLocked", "UserStatusDisabled" ] }, "domain.Webhook": { "type": "object", "properties": { "created_at": { "type": "string" }, "created_by": { "type": "integer" }, "events": { "description": "JSON 数组,订阅的事件类型", "type": "string" }, "id": { "type": "integer" }, "max_retries": { "type": "integer" }, "name": { "type": "string" }, "status": { "$ref": "#/definitions/domain.WebhookStatus" }, "timeout_sec": { "type": "integer" }, "updated_at": { "type": "string" }, "url": { "type": "string" } } }, "domain.WebhookEventType": { "type": "string", "enum": [ "user.registered", "user.login", "user.logout", "user.updated", "user.deleted", "user.locked", "user.password_changed", "user.password_reset", "user.totp_enabled", "user.totp_disabled", "user.login_failed", "security.anomaly_detected" ], "x-enum-varnames": [ "EventUserRegistered", "EventUserLogin", "EventUserLogout", "EventUserUpdated", "EventUserDeleted", "EventUserLocked", "EventPasswordChanged", "EventPasswordReset", "EventTOTPEnabled", "EventTOTPDisabled", "EventLoginFailed", "EventAnomalyDetected" ] }, "domain.WebhookStatus": { "type": "integer", "enum": [ 1, 0 ], "x-enum-varnames": [ "WebhookStatusActive", "WebhookStatusInactive" ] }, "handler.ActivateEmailRequest": { "type": "object", "required": [ "token" ], "properties": { "token": { "type": "string" } } }, "handler.AssignPermissionsRequest": { "type": "object", "properties": { "permission_ids": { "type": "array", "items": { "type": "integer" } } } }, "handler.AssignRolesRequest": { "type": "object", "properties": { "role_ids": { "type": "array", "items": { "type": "integer" } } } }, "handler.AvatarResponse": { "type": "object", "properties": { "avatar_url": { "type": "string" }, "thumbnail": { "type": "string" } } }, "handler.BootstrapAdminRequest": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" }, "username": { "type": "string" } } }, "handler.CSRFTokenResponse": { "type": "object", "properties": { "token": { "type": "string" } } }, "handler.CaptchaResponse": { "type": "object", "properties": { "captcha_id": { "type": "string" }, "image": { "type": "string" } } }, "handler.CreateAdminRequest": { "type": "object", "properties": { "email": { "type": "string" }, "nickname": { "type": "string" }, "password": { "type": "string" }, "username": { "type": "string" } } }, "handler.CreateUserRequest": { "type": "object", "properties": { "email": { "type": "string" }, "nickname": { "type": "string" }, "password": { "type": "string" }, "phone": { "type": "string" }, "username": { "type": "string" } } }, "handler.CustomFieldValuesResponse": { "type": "object", "additionalProperties": { "type": "string" } }, "handler.DeviceListResponse": { "type": "object", "properties": { "cursor": { "type": "string" }, "has_more": { "type": "boolean" }, "items": {}, "next_cursor": { "type": "string" }, "page": { "type": "integer" }, "page_size": { "type": "integer" }, "total": { "type": "integer" } } }, "handler.DisableTOTPRequest": { "type": "object", "properties": { "code": { "type": "string" } } }, "handler.EnableTOTPRequest": { "type": "object", "properties": { "code": { "type": "string" } } }, "handler.ForgotPasswordByPhoneRequest": { "type": "object", "required": [ "phone" ], "properties": { "phone": { "type": "string" } } }, "handler.ForgotPasswordRequest": { "type": "object", "properties": { "email": { "type": "string" } } }, "handler.IntrospectResponse": { "type": "object", "properties": { "active": { "type": "boolean" }, "exp": { "type": "integer" }, "scope": { "type": "string" }, "user_id": { "type": "integer" }, "username": { "type": "string" } } }, "handler.LoginByEmailCodeRequest": { "type": "object", "properties": { "code": { "type": "string" }, "device_browser": { "type": "string" }, "device_id": { "type": "string" }, "device_name": { "type": "string" }, "device_os": { "type": "string" }, "email": { "type": "string" } } }, "handler.LoginLogListResponse": { "type": "object", "properties": { "cursor": { "type": "string" }, "has_more": { "type": "boolean" }, "items": {}, "list": {}, "next_cursor": { "type": "string" }, "page": { "type": "integer" }, "page_size": { "type": "integer" }, "total": { "type": "integer" } } }, "handler.OAuthProvidersResponse": { "type": "object", "properties": { "providers": { "type": "array", "items": { "type": "string" } } } }, "handler.OperationLogListResponse": { "type": "object", "properties": { "cursor": { "type": "string" }, "has_more": { "type": "boolean" }, "items": {}, "list": {}, "next_cursor": { "type": "string" }, "page": { "type": "integer" }, "page_size": { "type": "integer" }, "total": { "type": "integer" } } }, "handler.RefreshTokenRequest": { "type": "object", "properties": { "refresh_token": { "type": "string" } } }, "handler.ResendActivationRequest": { "type": "object", "properties": { "email": { "type": "string" } } }, "handler.ResetPasswordByPhoneRequest": { "type": "object", "required": [ "code", "new_password", "phone" ], "properties": { "code": { "type": "string" }, "new_password": { "type": "string" }, "phone": { "type": "string" } } }, "handler.ResetPasswordRequest": { "type": "object", "properties": { "new_password": { "type": "string" }, "token": { "type": "string" } } }, "handler.Response": { "type": "object", "properties": { "code": { "type": "integer" }, "data": {}, "message": { "type": "string" } } }, "handler.RoleListResponse": { "type": "object", "properties": { "items": {}, "page": { "type": "integer" }, "page_size": { "type": "integer" }, "total": { "type": "integer" } } }, "handler.SMSLoginRequest": { "type": "object", "required": [ "code", "phone" ], "properties": { "code": { "type": "string" }, "device_browser": { "type": "string" }, "device_id": { "type": "string" }, "device_name": { "type": "string" }, "device_os": { "type": "string" }, "phone": { "type": "string" } } }, "handler.SendEmailCodeRequest": { "type": "object", "properties": { "email": { "type": "string" } } }, "handler.SetUserFieldValuesRequest": { "type": "object", "properties": { "values": { "type": "object", "additionalProperties": { "type": "string" } } } }, "handler.SwaggerCustomField": { "type": "object", "properties": { "active": { "type": "boolean" }, "created_at": { "type": "string" }, "field_key": { "type": "string" }, "field_type": { "type": "string" }, "help_text": { "type": "string" }, "id": { "type": "integer" }, "name": { "type": "string" }, "options": { "type": "string" }, "placeholder": { "type": "string" }, "required": { "type": "boolean" }, "sort_order": { "type": "integer" }, "updated_at": { "type": "string" } } }, "handler.SwaggerDevice": { "type": "object", "properties": { "created_at": { "type": "string" }, "current": { "type": "boolean" }, "device_browser": { "type": "string" }, "device_id": { "type": "string" }, "device_name": { "type": "string" }, "device_os": { "type": "string" }, "device_type": { "type": "integer" }, "id": { "type": "integer" }, "ip": { "type": "string" }, "is_trusted": { "type": "boolean" }, "last_active_at": { "type": "string" }, "last_used_at": { "type": "string" }, "location": { "type": "string" }, "status": { "type": "integer" }, "trusted_until": { "type": "string" }, "updated_at": { "type": "string" }, "user_id": { "type": "integer" } } }, "handler.SwaggerPermission": { "type": "object", "properties": { "code": { "type": "string" }, "created_at": { "type": "string" }, "description": { "type": "string" }, "icon": { "type": "string" }, "id": { "type": "integer" }, "method": { "type": "string" }, "name": { "type": "string" }, "parent_id": { "type": "integer" }, "path": { "type": "string" }, "sort": { "type": "integer" }, "status": { "type": "integer" }, "type": { "type": "integer" }, "updated_at": { "type": "string" } } }, "handler.SwaggerRole": { "type": "object", "properties": { "code": { "type": "string" }, "created_at": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "integer" }, "is_system": { "type": "boolean" }, "name": { "type": "string" }, "sort": { "type": "integer" }, "status": { "type": "integer" }, "updated_at": { "type": "string" } } }, "handler.SwaggerTheme": { "type": "object", "properties": { "accent_color": { "type": "string" }, "background_color": { "type": "string" }, "created_at": { "type": "string" }, "error_color": { "type": "string" }, "id": { "type": "integer" }, "info_color": { "type": "string" }, "is_default": { "type": "boolean" }, "name": { "type": "string" }, "primary_color": { "type": "string" }, "secondary_color": { "type": "string" }, "success_color": { "type": "string" }, "text_color": { "type": "string" }, "updated_at": { "type": "string" }, "warning_color": { "type": "string" } } }, "handler.TOTPSetupResponse": { "type": "object", "properties": { "qr_code_base64": { "type": "string" }, "recovery_codes": { "type": "array", "items": { "type": "string" } }, "secret": { "type": "string" } } }, "handler.TOTPStatusResponse": { "type": "object", "properties": { "enabled": { "type": "boolean" } } }, "handler.TOTPVerifyRequest": { "type": "object", "properties": { "code": { "type": "string" }, "device_id": { "type": "string" }, "temp_token": { "type": "string" }, "user_id": { "type": "integer" } } }, "handler.TokenResponse": { "type": "object", "properties": { "access_token": { "type": "string" }, "expires_in": { "type": "integer" }, "scope": { "type": "string" }, "token_type": { "type": "string" } } }, "handler.TrustDeviceRequest": { "type": "object", "properties": { "trust_duration": { "description": "信任持续时间,如 \"30d\" 表示30天", "type": "string" } } }, "handler.UpdateDeviceStatusRequest": { "type": "object", "properties": { "status": { "type": "string" } } }, "handler.UpdatePasswordRequest": { "type": "object", "properties": { "new_password": { "type": "string" }, "old_password": { "type": "string" } } }, "handler.UpdatePermissionStatusRequest": { "type": "object", "properties": { "status": { "type": "string" } } }, "handler.UpdateRoleStatusRequest": { "type": "object", "properties": { "status": { "type": "string" } } }, "handler.UpdateStatusRequest": { "type": "object", "properties": { "status": { "type": "string" } } }, "handler.UpdateUserRequest": { "type": "object", "properties": { "email": { "type": "string" }, "nickname": { "type": "string" } } }, "handler.UserInfoResponse": { "type": "object", "properties": { "user_id": { "type": "integer" }, "username": { "type": "string" } } }, "handler.UserListResponse": { "type": "object", "properties": { "has_more": { "type": "boolean" }, "items": {}, "limit": { "type": "integer" }, "next_cursor": { "type": "string" }, "offset": { "type": "integer" }, "page_size": { "type": "integer" }, "total": { "type": "integer" }, "users": {} } }, "handler.UserResponse": { "type": "object", "properties": { "email": { "type": "string" }, "id": { "type": "integer" }, "nickname": { "type": "string" }, "status": { "type": "string" }, "username": { "type": "string" } } }, "handler.ValidateResetTokenRequest": { "type": "object", "required": [ "token" ], "properties": { "token": { "type": "string" } } }, "handler.ValidateTokenResponse": { "type": "object", "properties": { "valid": { "type": "boolean" } } }, "handler.VerifyCaptchaRequest": { "type": "object", "properties": { "answer": { "type": "string" }, "captcha_id": { "type": "string" } } }, "handler.VerifyResponse": { "type": "object", "properties": { "verified": { "type": "boolean" } } }, "handler.VerifyTOTPRequest": { "type": "object", "properties": { "code": { "type": "string" }, "device_id": { "type": "string" } } }, "handler.VerifyTOTPResponse": { "type": "object", "properties": { "verified": { "type": "boolean" } } }, "service.AuthCapabilities": { "type": "object", "properties": { "admin_bootstrap_required": { "type": "boolean" }, "email_activation": { "type": "boolean" }, "email_code": { "type": "boolean" }, "oauth_providers": { "type": "array", "items": { "$ref": "#/definitions/auth.OAuthProviderInfo" } }, "password": { "type": "boolean" }, "password_reset": { "type": "boolean" }, "sms_code": { "type": "boolean" } } }, "service.BatchDeleteRequest": { "type": "object", "required": [ "ids" ], "properties": { "ids": { "type": "array", "minItems": 1, "items": { "type": "integer" } } } }, "service.BatchUpdateStatusRequest": { "type": "object", "required": [ "ids", "status" ], "properties": { "ids": { "type": "array", "minItems": 1, "items": { "type": "integer" } }, "status": { "$ref": "#/definitions/domain.UserStatus" } } }, "service.CreateDeviceRequest": { "type": "object", "required": [ "device_id" ], "properties": { "device_browser": { "type": "string" }, "device_id": { "type": "string" }, "device_name": { "type": "string" }, "device_os": { "type": "string" }, "device_type": { "type": "integer" }, "ip": { "type": "string" }, "location": { "type": "string" } } }, "service.CreateFieldRequest": { "type": "object", "required": [ "field_key", "name", "type" ], "properties": { "default": { "type": "string" }, "field_key": { "type": "string" }, "max_len": { "type": "integer" }, "max_val": { "type": "number" }, "min_len": { "type": "integer" }, "min_val": { "type": "number" }, "name": { "type": "string" }, "options": { "type": "string" }, "required": { "type": "boolean" }, "sort": { "type": "integer" }, "type": { "type": "integer" } } }, "service.CreatePermissionRequest": { "type": "object", "required": [ "code", "name", "type" ], "properties": { "code": { "type": "string" }, "description": { "type": "string" }, "icon": { "type": "string" }, "method": { "type": "string" }, "name": { "type": "string" }, "parent_id": { "type": "integer" }, "path": { "type": "string" }, "sort": { "type": "integer" }, "type": { "type": "integer" } } }, "service.CreateRoleRequest": { "type": "object", "required": [ "code", "name" ], "properties": { "code": { "type": "string" }, "description": { "type": "string" }, "name": { "type": "string" }, "parent_id": { "type": "integer" } } }, "service.CreateThemeRequest": { "type": "object", "required": [ "name" ], "properties": { "background_color": { "type": "string" }, "custom_css": { "type": "string" }, "custom_js": { "type": "string" }, "favicon_url": { "type": "string" }, "is_default": { "type": "boolean" }, "logo_url": { "type": "string" }, "name": { "type": "string" }, "primary_color": { "type": "string" }, "secondary_color": { "type": "string" }, "text_color": { "type": "string" } } }, "service.CreateWebhookRequest": { "type": "object", "required": [ "events", "name", "url" ], "properties": { "events": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/domain.WebhookEventType" } }, "name": { "type": "string" }, "secret": { "type": "string" }, "url": { "type": "string" } } }, "service.DashboardStats": { "type": "object", "properties": { "logins": { "$ref": "#/definitions/service.LoginStats" }, "users": { "$ref": "#/definitions/service.UserStats" } } }, "service.FeaturesInfo": { "type": "object", "properties": { "data_export_enabled": { "type": "boolean" }, "data_import_enabled": { "type": "boolean" }, "email_verification": { "type": "boolean" }, "login_log_enabled": { "type": "boolean" }, "oauth_providers": { "type": "array", "items": { "type": "string" } }, "operation_log_enabled": { "type": "boolean" }, "phone_verification": { "type": "boolean" }, "sso_enabled": { "type": "boolean" } } }, "service.LoginRequest": { "type": "object", "properties": { "account": { "type": "string" }, "device_browser": { "description": "浏览器", "type": "string" }, "device_id": { "description": "设备唯一标识", "type": "string" }, "device_name": { "description": "设备名称", "type": "string" }, "device_os": { "description": "操作系统", "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" }, "phone": { "type": "string" }, "remember": { "description": "记住登录", "type": "boolean" }, "username": { "type": "string" } } }, "service.LoginResponse": { "type": "object", "properties": { "access_token": { "type": "string" }, "expires_in": { "type": "integer" }, "refresh_token": { "type": "string" }, "requires_totp": { "description": "RequiresTOTP 指示登录需要额外的TOTP验证(当设备未信任时)", "type": "boolean" }, "temp_token": { "description": "TempToken 临时令牌,用于TOTP验证阶段(短生命周期,不可用于常规API)", "type": "string" }, "user": { "$ref": "#/definitions/service.UserInfo" }, "user_id": { "description": "UserID 当RequiresTOTP为true时返回,用于后续TOTP验证", "type": "integer" } } }, "service.LoginStats": { "type": "object", "properties": { "logins_today_failed": { "type": "integer" }, "logins_today_success": { "type": "integer" }, "logins_week": { "type": "integer" } } }, "service.LogoutRequest": { "type": "object", "properties": { "access_token": { "type": "string" }, "refresh_token": { "type": "string" } } }, "service.RegisterRequest": { "type": "object", "required": [ "password", "username" ], "properties": { "email": { "type": "string" }, "nickname": { "type": "string" }, "password": { "type": "string" }, "phone": { "type": "string" }, "phone_code": { "type": "string" }, "username": { "type": "string" } } }, "service.SecurityInfo": { "type": "object", "properties": { "device_trust_duration": { "description": "秒", "type": "integer" }, "login_fail_duration": { "description": "分钟", "type": "integer" }, "login_fail_lock": { "type": "boolean" }, "login_fail_threshold": { "type": "integer" }, "password_history": { "type": "integer" }, "password_min_length": { "type": "integer" }, "password_require_lowercase": { "type": "boolean" }, "password_require_numbers": { "type": "boolean" }, "password_require_symbols": { "type": "boolean" }, "password_require_uppercase": { "type": "boolean" }, "session_timeout": { "description": "秒", "type": "integer" }, "totp_enabled": { "type": "boolean" } } }, "service.SendCodeRequest": { "type": "object", "required": [ "phone" ], "properties": { "phone": { "type": "string" }, "purpose": { "type": "string" }, "scene": { "type": "string" } } }, "service.SystemInfo": { "type": "object", "properties": { "description": { "type": "string" }, "environment": { "type": "string" }, "name": { "type": "string" }, "version": { "type": "string" } } }, "service.SystemSettings": { "type": "object", "properties": { "features": { "$ref": "#/definitions/service.FeaturesInfo" }, "security": { "$ref": "#/definitions/service.SecurityInfo" }, "system": { "$ref": "#/definitions/service.SystemInfo" } } }, "service.UpdateDeviceRequest": { "type": "object", "properties": { "device_browser": { "type": "string" }, "device_name": { "type": "string" }, "device_os": { "type": "string" }, "device_type": { "type": "integer" }, "ip": { "type": "string" }, "location": { "type": "string" }, "status": { "type": "integer" } } }, "service.UpdateFieldRequest": { "type": "object", "properties": { "default": { "type": "string" }, "max_len": { "type": "integer" }, "max_val": { "type": "number" }, "min_len": { "type": "integer" }, "min_val": { "type": "number" }, "name": { "type": "string" }, "options": { "type": "string" }, "required": { "type": "boolean" }, "sort": { "type": "integer" }, "status": { "type": "integer" }, "type": { "type": "integer" } } }, "service.UpdatePermissionRequest": { "type": "object", "properties": { "description": { "type": "string" }, "icon": { "type": "string" }, "method": { "type": "string" }, "name": { "type": "string" }, "parent_id": { "type": "integer" }, "path": { "type": "string" }, "sort": { "type": "integer" } } }, "service.UpdateRoleRequest": { "type": "object", "properties": { "description": { "type": "string" }, "name": { "type": "string" }, "parent_id": { "type": "integer" } } }, "service.UpdateThemeRequest": { "type": "object", "properties": { "background_color": { "type": "string" }, "custom_css": { "type": "string" }, "custom_js": { "type": "string" }, "enabled": { "type": "boolean" }, "favicon_url": { "type": "string" }, "is_default": { "type": "boolean" }, "logo_url": { "type": "string" }, "primary_color": { "type": "string" }, "secondary_color": { "type": "string" }, "text_color": { "type": "string" } } }, "service.UpdateWebhookRequest": { "type": "object", "properties": { "events": { "type": "array", "items": { "$ref": "#/definitions/domain.WebhookEventType" } }, "name": { "type": "string" }, "status": { "$ref": "#/definitions/domain.WebhookStatus" }, "url": { "type": "string" } } }, "service.UserInfo": { "type": "object", "properties": { "avatar": { "type": "string" }, "email": { "type": "string" }, "id": { "type": "integer" }, "nickname": { "type": "string" }, "phone": { "type": "string" }, "status": { "$ref": "#/definitions/domain.UserStatus" }, "username": { "type": "string" } } }, "service.UserStats": { "type": "object", "properties": { "active_users": { "type": "integer" }, "disabled_users": { "type": "integer" }, "inactive_users": { "type": "integer" }, "locked_users": { "type": "integer" }, "new_users_month": { "type": "integer" }, "new_users_today": { "type": "integer" }, "new_users_week": { "type": "integer" }, "total_users": { "type": "integer" } } } } }