Files
license-manager/backend/docs/swagger/docs.go
T

3941 lines
139 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Code generated by swaggo/swag. DO NOT EDIT.
package swagger
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/customers": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "分页查询客户列表,支持搜索和筛选",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"客户管理"
],
"summary": "查询客户列表",
"parameters": [
{
"minimum": 1,
"type": "integer",
"description": "页码,默认1",
"name": "page",
"in": "query"
},
{
"maximum": 100,
"minimum": 1,
"type": "integer",
"description": "每页条数,默认20,最大100",
"name": "page_size",
"in": "query"
},
{
"type": "string",
"description": "搜索关键词(支持客户编码、名称、联系人、邮箱)",
"name": "search",
"in": "query"
},
{
"enum": [
"individual",
"enterprise",
"government",
"education"
],
"type": "string",
"description": "客户类型筛选",
"name": "customer_type",
"in": "query"
},
{
"enum": [
"normal",
"vip",
"enterprise",
"strategic"
],
"type": "string",
"description": "客户等级筛选",
"name": "customer_level",
"in": "query"
},
{
"enum": [
"active",
"disabled"
],
"type": "string",
"description": "状态筛选",
"name": "status",
"in": "query"
},
{
"enum": [
"created_at",
"updated_at",
"customer_name",
"customer_code"
],
"type": "string",
"description": "排序字段,默认created_at",
"name": "sort",
"in": "query"
},
{
"enum": [
"asc",
"desc"
],
"type": "string",
"description": "排序方向,默认desc",
"name": "order",
"in": "query"
}
],
"responses": {
"200": {
"description": "查询成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.CustomerListResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "创建新的客户记录,自动生成客户编码",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"客户管理"
],
"summary": "创建客户",
"parameters": [
{
"description": "客户信息",
"name": "customer",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CustomerCreateRequest"
}
}
],
"responses": {
"200": {
"description": "创建成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Customer"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"409": {
"description": "客户已存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/customers/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据客户ID获取客户详细信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"客户管理"
],
"summary": "获取客户详情",
"parameters": [
{
"type": "string",
"description": "客户ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "查询成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Customer"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "客户不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "更新客户信息,所有字段都是可选的",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"客户管理"
],
"summary": "更新客户信息",
"parameters": [
{
"type": "string",
"description": "客户ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "客户信息",
"name": "customer",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CustomerUpdateRequest"
}
}
],
"responses": {
"200": {
"description": "更新成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Customer"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "客户不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "直接删除客户记录,删除前会检查是否有关联的授权码或许可证,如有则提示先删除授权",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"客户管理"
],
"summary": "删除客户",
"parameters": [
{
"type": "string",
"description": "客户ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "删除成功",
"schema": {
"$ref": "#/definitions/models.APIResponse"
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "客户不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"409": {
"description": "客户仍有授权,无法删除",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/customers/{id}/status": {
"patch": {
"security": [
{
"BearerAuth": []
}
],
"description": "修改客户状态(激活/停用)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"客户管理"
],
"summary": "修改客户状态",
"parameters": [
{
"type": "string",
"description": "客户ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "状态信息",
"name": "status",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CustomerStatusUpdateRequest"
}
}
],
"responses": {
"200": {
"description": "状态更新成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Customer"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "客户不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/enums": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "获取系统中所有枚举类型及其对应的多语言显示值",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"枚举管理"
],
"summary": "获取所有枚举值",
"responses": {
"200": {
"description": "查询成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.EnumListResponse"
}
}
}
]
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/enums/{type}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据枚举类型获取对应的多语言显示值",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"枚举管理"
],
"summary": "获取指定类型的枚举值",
"parameters": [
{
"enum": [
"customer_type",
"customer_level",
"customer_status",
"company_size"
],
"type": "string",
"description": "枚举类型",
"name": "type",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "查询成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.EnumTypeResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/activate": {
"post": {
"description": "客户端使用授权码激活软件,获取许可证文件",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"许可证激活"
],
"summary": "激活许可证",
"parameters": [
{
"description": "激活请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ActivateRequest"
}
}
],
"responses": {
"200": {
"description": "激活成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.ActivateResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "授权码不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"409": {
"description": "授权码已锁定或已过期",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"429": {
"description": "激活数量已达上限",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/admin/system/info": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "获取详细的系统信息(需要管理员权限)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"系统"
],
"summary": "获取系统信息",
"responses": {
"200": {
"description": "系统信息",
"schema": {
"$ref": "#/definitions/models.APIResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"403": {
"description": "权限不足",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/auth/refresh": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "刷新用户Token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "刷新Token",
"responses": {
"200": {
"description": "刷新成功",
"schema": {
"$ref": "#/definitions/models.APIResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/authorization-codes": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "分页查询授权码列表,支持筛选和排序",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"授权码管理"
],
"summary": "查询授权码列表",
"parameters": [
{
"minimum": 1,
"type": "integer",
"description": "页码,默认1",
"name": "page",
"in": "query"
},
{
"maximum": 100,
"minimum": 1,
"type": "integer",
"description": "每页条数,默认20,最大100",
"name": "page_size",
"in": "query"
},
{
"type": "string",
"description": "客户ID筛选",
"name": "customer_id",
"in": "query"
},
{
"enum": [
"normal",
"locked",
"expired"
],
"type": "string",
"description": "状态筛选",
"name": "status",
"in": "query"
},
{
"type": "string",
"description": "创建开始时间",
"name": "start_date",
"in": "query"
},
{
"type": "string",
"description": "创建结束时间",
"name": "end_date",
"in": "query"
},
{
"enum": [
"created_at",
"updated_at",
"code"
],
"type": "string",
"description": "排序字段,默认created_at",
"name": "sort",
"in": "query"
},
{
"enum": [
"asc",
"desc"
],
"type": "string",
"description": "排序方向,默认desc",
"name": "order",
"in": "query"
}
],
"responses": {
"200": {
"description": "查询成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.AuthorizationCodeListResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "创建新的授权码,自动生成授权码字符串。有效期从当天00:00:00开始,到指定天数后的23:59:59结束",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"授权码管理"
],
"summary": "创建授权码",
"parameters": [
{
"description": "授权码信息",
"name": "authorization_code",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.AuthorizationCodeCreateRequest"
}
}
],
"responses": {
"200": {
"description": "创建成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.AuthorizationCodeCreateResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "客户不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"409": {
"description": "授权码已存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/authorization-codes/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据授权码ID获取授权码详细信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"授权码管理"
],
"summary": "获取授权码详情",
"parameters": [
{
"type": "string",
"description": "授权码ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "查询成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.AuthorizationCode"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "授权码不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "更新授权码信息,所有字段都是可选的,需要指定变更类型和原因",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"授权码管理"
],
"summary": "更新授权码",
"parameters": [
{
"type": "string",
"description": "授权码ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "授权码信息",
"name": "authorization_code",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.AuthorizationCodeUpdateRequest"
}
}
],
"responses": {
"200": {
"description": "更新成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.AuthorizationCode"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "授权码不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "删除指定的授权码(软删除)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"授权码管理"
],
"summary": "删除授权码",
"parameters": [
{
"type": "string",
"description": "授权码ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "删除成功",
"schema": {
"$ref": "#/definitions/models.APIResponse"
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "授权码不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/authorization-codes/{id}/changes": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "分页查询指定授权码的变更历史,支持筛选",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"授权码管理"
],
"summary": "查询授权变更历史列表",
"parameters": [
{
"type": "string",
"description": "授权码ID",
"name": "id",
"in": "path",
"required": true
},
{
"minimum": 1,
"type": "integer",
"description": "页码,默认1",
"name": "page",
"in": "query"
},
{
"maximum": 100,
"minimum": 1,
"type": "integer",
"description": "每页条数,默认20,最大100",
"name": "page_size",
"in": "query"
},
{
"type": "string",
"description": "变更类型筛选",
"name": "change_type",
"in": "query"
},
{
"type": "string",
"description": "操作人筛选",
"name": "operator_id",
"in": "query"
},
{
"type": "string",
"description": "开始时间 (YYYY-MM-DD格式)",
"name": "start_date",
"in": "query"
},
{
"type": "string",
"description": "结束时间 (YYYY-MM-DD格式)",
"name": "end_date",
"in": "query"
},
{
"enum": [
"created_at",
"change_type"
],
"type": "string",
"description": "排序字段,默认created_at",
"name": "sort",
"in": "query"
},
{
"enum": [
"asc",
"desc"
],
"type": "string",
"description": "排序方向,默认desc",
"name": "order",
"in": "query"
}
],
"responses": {
"200": {
"description": "查询成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.AuthorizationChangeListResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "授权码不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/authorization-codes/{id}/download": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "下载授权码文件,包含授权码和RSA公钥,供客户端使用",
"consumes": [
"application/json"
],
"produces": [
"application/zip"
],
"tags": [
"授权码管理"
],
"summary": "下载授权文件",
"parameters": [
{
"type": "string",
"description": "授权码ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "包含授权码文件和RSA公钥的压缩包",
"schema": {
"type": "file"
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "授权码不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"409": {
"description": "授权码不可用",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/authorization-codes/{id}/lock": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "锁定或解锁指定的授权码,可以设置锁定原因",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"授权码管理"
],
"summary": "锁定/解锁授权码",
"parameters": [
{
"type": "string",
"description": "授权码ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "锁定/解锁信息",
"name": "lock_request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.AuthorizationCodeLockRequest"
}
}
],
"responses": {
"200": {
"description": "操作成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.AuthorizationCode"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "授权码不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/dashboard/authorization-trend": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据时间类型(本周/本月/自定义)获取授权趋势统计数据",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"仪表盘"
],
"summary": "获取授权趋势数据",
"parameters": [
{
"enum": [
"week",
"month",
"custom"
],
"type": "string",
"description": "时间类型",
"name": "type",
"in": "query",
"required": true
},
{
"type": "string",
"description": "开始日期(YYYY-MM-DD格式,当type为custom时必填)",
"name": "start_date",
"in": "query"
},
{
"type": "string",
"description": "结束日期(YYYY-MM-DD格式,当type为custom时必填)",
"name": "end_date",
"in": "query"
},
{
"type": "string",
"description": "时区(如:Asia/Shanghai,UTC等,默认使用服务器本地时区)",
"name": "timezone",
"in": "query"
}
],
"responses": {
"200": {
"description": "授权趋势数据",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.DashboardAuthorizationTrendResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"403": {
"description": "权限不足",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/dashboard/recent-authorizations": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "获取最近创建的授权码列表,支持按客户ID和状态筛选",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"仪表盘"
],
"summary": "获取最近授权列表",
"parameters": [
{
"type": "integer",
"description": "返回数量限制(默认20,最大100)",
"name": "limit",
"in": "query"
},
{
"type": "string",
"description": "客户ID筛选",
"name": "customer_id",
"in": "query"
},
{
"enum": [
"normal",
"locked",
"expired"
],
"type": "string",
"description": "状态筛选",
"name": "status",
"in": "query"
}
],
"responses": {
"200": {
"description": "最近授权列表",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.DashboardRecentAuthorizationsResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"403": {
"description": "权限不足",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/heartbeat": {
"post": {
"description": "客户端定期发送心跳,更新在线状态和使用数据",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"许可证激活"
],
"summary": "心跳检测",
"parameters": [
{
"description": "心跳请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.HeartbeatRequest"
}
}
],
"responses": {
"200": {
"description": "心跳成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.HeartbeatResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "许可证不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"409": {
"description": "许可证已被撤销",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/licenses": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "分页查询许可证列表,支持筛选",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"许可证管理"
],
"summary": "查询许可证列表",
"parameters": [
{
"minimum": 1,
"type": "integer",
"description": "页码,默认1",
"name": "page",
"in": "query"
},
{
"maximum": 100,
"minimum": 1,
"type": "integer",
"description": "每页条数,默认20,最大100",
"name": "page_size",
"in": "query"
},
{
"type": "string",
"description": "授权码ID筛选",
"name": "authorization_code_id",
"in": "query"
},
{
"type": "string",
"description": "客户ID筛选",
"name": "customer_id",
"in": "query"
},
{
"enum": [
"active",
"inactive",
"revoked"
],
"type": "string",
"description": "状态筛选",
"name": "status",
"in": "query"
},
{
"type": "boolean",
"description": "在线状态筛选",
"name": "is_online",
"in": "query"
},
{
"enum": [
"created_at",
"updated_at",
"activated_at",
"last_heartbeat"
],
"type": "string",
"description": "排序字段,默认created_at",
"name": "sort",
"in": "query"
},
{
"enum": [
"asc",
"desc"
],
"type": "string",
"description": "排序方向,默认desc",
"name": "order",
"in": "query"
}
],
"responses": {
"200": {
"description": "查询成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.LicenseListResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "为指定授权码手动创建许可证",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"许可证管理"
],
"summary": "手动添加许可证",
"parameters": [
{
"description": "许可证创建信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.LicenseCreateRequest"
}
}
],
"responses": {
"201": {
"description": "创建成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.License"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "授权码不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/licenses/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据许可证ID获取许可证详细信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"许可证管理"
],
"summary": "获取许可证详情",
"parameters": [
{
"type": "string",
"description": "许可证ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "查询成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.LicenseDetailResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "许可证不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/licenses/{id}/download": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "下载加密的许可证文件,用于客户端软件激活",
"consumes": [
"application/json"
],
"produces": [
"application/zip"
],
"tags": [
"许可证管理"
],
"summary": "下载许可证文件",
"parameters": [
{
"type": "string",
"description": "许可证ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "包含许可证文件和RSA公钥的压缩包",
"schema": {
"type": "file"
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "许可证不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"409": {
"description": "许可证已被撤销",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/licenses/{id}/revoke": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "撤销指定的许可证,撤销后无法再使用",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"许可证管理"
],
"summary": "撤销许可证",
"parameters": [
{
"type": "string",
"description": "许可证ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "撤销原因",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.LicenseRevokeRequest"
}
}
],
"responses": {
"200": {
"description": "撤销成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.License"
}
}
}
]
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"404": {
"description": "许可证不存在",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"409": {
"description": "许可证已被撤销",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/login": {
"post": {
"description": "管理员用户登录接口",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "用户登录",
"parameters": [
{
"description": "登录请求参数",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.LoginRequest"
}
}
],
"responses": {
"200": {
"description": "登录成功",
"schema": {
"$ref": "#/definitions/models.LoginResponse"
}
},
"400": {
"description": "请求参数无效",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"401": {
"description": "用户名或密码错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/logout": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "用户登出接口",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "用户登出",
"responses": {
"200": {
"description": "登出成功",
"schema": {
"$ref": "#/definitions/models.APIResponse"
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/v1/stats/overview": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "获取授权码、许可证的总体统计信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"统计分析"
],
"summary": "获取授权概览统计",
"responses": {
"200": {
"description": "查询成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/models.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.StatsOverviewResponse"
}
}
}
]
}
},
"401": {
"description": "未认证",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/health": {
"get": {
"description": "系统健康状态检查",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"系统"
],
"summary": "健康检测",
"responses": {
"200": {
"description": "健康状态",
"schema": {
"$ref": "#/definitions/models.HealthResponse"
}
}
}
}
}
},
"definitions": {
"models.APIResponse": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"data": {},
"message": {
"type": "string"
},
"timestamp": {
"type": "string"
}
}
},
"models.ActivateRequest": {
"type": "object",
"required": [
"authorization_code",
"hardware_fingerprint"
],
"properties": {
"authorization_code": {
"description": "授权码,必填",
"type": "string"
},
"device_info": {
"description": "设备信息,可选",
"type": "object",
"additionalProperties": true
},
"hardware_fingerprint": {
"description": "硬件指纹,必填",
"type": "string"
},
"software_version": {
"description": "软件版本,可选",
"type": "string"
}
}
},
"models.ActivateResponse": {
"type": "object",
"properties": {
"heartbeat_interval": {
"description": "心跳间隔(秒)",
"type": "integer"
},
"license_file": {
"description": "base64编码的加密许可证文件",
"type": "string"
},
"license_key": {
"description": "许可证密钥",
"type": "string"
}
}
},
"models.AuthorizationChangeListItem": {
"type": "object",
"properties": {
"change_type": {
"description": "变更类型",
"type": "string"
},
"change_type_display": {
"description": "变更类型显示(多语言)",
"type": "string"
},
"created_at": {
"description": "创建时间",
"type": "string"
},
"id": {
"description": "变更记录ID",
"type": "string"
},
"operator_id": {
"description": "操作人ID",
"type": "string"
},
"operator_name": {
"description": "操作人名称",
"type": "string"
},
"reason": {
"description": "变更原因",
"type": "string"
}
}
},
"models.AuthorizationChangeListResponse": {
"type": "object",
"properties": {
"list": {
"description": "变更历史列表",
"type": "array",
"items": {
"$ref": "#/definitions/models.AuthorizationChangeListItem"
}
},
"page": {
"description": "当前页码",
"type": "integer"
},
"page_size": {
"description": "每页条数",
"type": "integer"
},
"total": {
"description": "总记录数",
"type": "integer"
},
"total_pages": {
"description": "总页数",
"type": "integer"
}
}
},
"models.AuthorizationCode": {
"type": "object",
"properties": {
"activated_licenses_count": {
"description": "该授权码下已激活的许可证数量",
"type": "integer"
},
"code": {
"description": "授权码",
"type": "string"
},
"created_at": {
"description": "创建时间",
"type": "string"
},
"created_by": {
"description": "创建人ID",
"type": "string"
},
"current_activations": {
"description": "当前激活次数",
"type": "integer"
},
"custom_parameters": {
"description": "自定义参数(JSON对象)",
"type": "object"
},
"customer_id": {
"description": "客户ID",
"type": "string"
},
"customer_info": {
"description": "客户信息(仅在详情接口返回)",
"allOf": [
{
"$ref": "#/definitions/models.CustomerInfoForAuthCode"
}
]
},
"customer_name": {
"description": "客户名称",
"type": "string"
},
"customer_name_display": {
"description": "客户名称显示(多语言)",
"type": "string"
},
"deployment_type": {
"description": "部署类型:standalone/cloud/hybrid",
"type": "string"
},
"deployment_type_display": {
"description": "部署类型显示(多语言)",
"type": "string"
},
"description": {
"description": "描述",
"type": "string"
},
"encryption_type": {
"description": "加密类型:standard/advanced",
"type": "string"
},
"encryption_type_display": {
"description": "加密类型显示(多语言)",
"type": "string"
},
"end_date": {
"description": "失效日期",
"type": "string"
},
"feature_config": {
"description": "功能配置(JSON对象)",
"type": "object"
},
"id": {
"description": "授权码ID",
"type": "string"
},
"is_locked": {
"description": "是否锁定",
"type": "boolean"
},
"lock_reason": {
"description": "锁定原因",
"type": "string"
},
"locked_at": {
"description": "锁定时间",
"type": "string"
},
"locked_by": {
"description": "锁定人ID",
"type": "string"
},
"max_activations": {
"description": "最大激活次数",
"type": "integer"
},
"software_id": {
"description": "软件ID",
"type": "string"
},
"software_version": {
"description": "软件版本",
"type": "string"
},
"start_date": {
"description": "生效日期",
"type": "string"
},
"status": {
"description": "状态:normal/locked/expired",
"type": "string"
},
"status_display": {
"description": "状态显示(多语言)",
"type": "string"
},
"updated_at": {
"description": "更新时间",
"type": "string"
},
"usage_limits": {
"description": "使用限制(JSON对象)",
"type": "object"
}
}
},
"models.AuthorizationCodeCreateRequest": {
"type": "object",
"required": [
"customer_id",
"deployment_type",
"max_activations",
"validity_days"
],
"properties": {
"custom_parameters": {
"description": "自定义参数(JSON对象)"
},
"customer_id": {
"description": "客户ID",
"type": "string"
},
"deployment_type": {
"description": "部署类型:standalone/cloud/hybrid",
"type": "string",
"enum": [
"standalone",
"cloud",
"hybrid"
]
},
"description": {
"description": "描述",
"type": "string",
"maxLength": 1000
},
"encryption_type": {
"description": "加密类型:standard/advanced",
"type": "string",
"enum": [
"standard",
"advanced"
]
},
"feature_config": {
"description": "功能配置(JSON对象)"
},
"max_activations": {
"description": "最大激活次数",
"type": "integer",
"minimum": 1
},
"software_id": {
"description": "软件ID",
"type": "string"
},
"software_version": {
"description": "软件版本",
"type": "string"
},
"usage_limits": {
"description": "使用限制(JSON对象)"
},
"validity_days": {
"description": "有效天数(1-365000天,365000代表永久有效)",
"type": "integer",
"maximum": 365000,
"minimum": 1
}
}
},
"models.AuthorizationCodeCreateResponse": {
"type": "object",
"properties": {
"code": {
"description": "授权码",
"type": "string"
},
"id": {
"description": "授权码ID",
"type": "string"
}
}
},
"models.AuthorizationCodeListItem": {
"type": "object",
"properties": {
"code": {
"description": "授权码",
"type": "string"
},
"created_at": {
"description": "创建时间",
"type": "string"
},
"current_activations": {
"description": "当前激活次数",
"type": "integer"
},
"customer_id": {
"description": "客户ID",
"type": "string"
},
"customer_name": {
"description": "客户名称",
"type": "string"
},
"customer_name_display": {
"description": "客户名称显示(多语言)",
"type": "string"
},
"deployment_type": {
"description": "部署类型:standalone/cloud/hybrid",
"type": "string"
},
"deployment_type_display": {
"description": "部署类型显示(多语言)",
"type": "string"
},
"description": {
"description": "描述",
"type": "string"
},
"end_date": {
"description": "失效日期",
"type": "string"
},
"id": {
"description": "授权码ID",
"type": "string"
},
"is_locked": {
"description": "是否锁定",
"type": "boolean"
},
"max_activations": {
"description": "最大激活次数",
"type": "integer"
},
"start_date": {
"description": "生效日期",
"type": "string"
},
"status": {
"description": "状态:normal/locked/expired",
"type": "string"
},
"status_display": {
"description": "状态显示(多语言)",
"type": "string"
}
}
},
"models.AuthorizationCodeListResponse": {
"type": "object",
"properties": {
"list": {
"description": "授权码列表",
"type": "array",
"items": {
"$ref": "#/definitions/models.AuthorizationCodeListItem"
}
},
"page": {
"description": "当前页码",
"type": "integer"
},
"page_size": {
"description": "每页条数",
"type": "integer"
},
"total": {
"description": "总记录数",
"type": "integer"
},
"total_pages": {
"description": "总页数",
"type": "integer"
}
}
},
"models.AuthorizationCodeLockRequest": {
"type": "object",
"properties": {
"is_locked": {
"description": "true-锁定,false-解锁",
"type": "boolean"
},
"lock_reason": {
"description": "锁定原因",
"type": "string",
"maxLength": 500
},
"reason": {
"description": "变更原因(记录到变更历史)",
"type": "string",
"maxLength": 500
}
}
},
"models.AuthorizationCodeUpdateRequest": {
"type": "object",
"required": [
"change_type"
],
"properties": {
"change_type": {
"description": "变更类型:renewal/upgrade/limit_change/feature_toggle/lock/unlock/other",
"type": "string",
"enum": [
"renewal",
"upgrade",
"limit_change",
"feature_toggle",
"lock",
"unlock",
"other"
]
},
"custom_parameters": {
"description": "自定义参数"
},
"deployment_type": {
"description": "部署类型:standalone/cloud/hybrid",
"type": "string",
"enum": [
"standalone",
"cloud",
"hybrid"
]
},
"description": {
"description": "描述",
"type": "string",
"maxLength": 1000
},
"encryption_type": {
"description": "加密类型:standard/advanced",
"type": "string",
"enum": [
"standard",
"advanced"
]
},
"feature_config": {
"description": "功能配置"
},
"max_activations": {
"description": "最大激活次数",
"type": "integer",
"minimum": 1
},
"reason": {
"description": "变更原因",
"type": "string",
"maxLength": 500
},
"software_id": {
"description": "软件ID",
"type": "string"
},
"software_version": {
"description": "软件版本",
"type": "string"
},
"usage_limits": {
"description": "使用限制"
},
"validity_days": {
"description": "有效天数(1-365000天,365000代表永久有效)",
"type": "integer",
"maximum": 365000,
"minimum": 1
}
}
},
"models.AuthorizationStats": {
"type": "object",
"properties": {
"active_licenses": {
"description": "已激活许可证数量",
"type": "integer"
},
"expired_auth_codes": {
"description": "已过期授权码数量",
"type": "integer"
},
"expired_licenses": {
"description": "已过期许可证数量",
"type": "integer"
},
"expiring_soon_auth_codes": {
"description": "30日内即将到期授权码数量",
"type": "integer"
},
"inactive_licenses": {
"description": "未激活许可证数量",
"type": "integer"
},
"total_auth_codes": {
"description": "总授权码数量",
"type": "integer"
},
"total_licenses": {
"description": "总许可证数量",
"type": "integer"
}
}
},
"models.Customer": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"authorization_stats": {
"description": "授权统计信息(仅在详情接口返回)",
"allOf": [
{
"$ref": "#/definitions/models.AuthorizationStats"
}
]
},
"company_size": {
"type": "string"
},
"company_size_display": {
"type": "string"
},
"contact_person": {
"type": "string"
},
"contact_title": {
"type": "string"
},
"created_at": {
"type": "string"
},
"created_by": {
"type": "string"
},
"customer_code": {
"type": "string"
},
"customer_level": {
"type": "string"
},
"customer_level_display": {
"type": "string"
},
"customer_name": {
"type": "string"
},
"customer_type": {
"type": "string"
},
"customer_type_display": {
"type": "string"
},
"description": {
"type": "string"
},
"email": {
"type": "string"
},
"id": {
"type": "string"
},
"phone": {
"type": "string"
},
"status": {
"type": "string"
},
"status_display": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"updated_by": {
"type": "string"
}
}
},
"models.CustomerCreateRequest": {
"type": "object",
"required": [
"contact_person",
"customer_level",
"customer_name",
"customer_type",
"status"
],
"properties": {
"address": {
"description": "地址,可选",
"type": "string",
"maxLength": 500
},
"company_size": {
"description": "企业规模,可选",
"type": "string"
},
"contact_person": {
"description": "联系人姓名,必填",
"type": "string",
"maxLength": 100
},
"contact_title": {
"description": "联系人职位,可选",
"type": "string",
"maxLength": 100
},
"customer_level": {
"description": "客户等级,必填",
"type": "string"
},
"customer_name": {
"description": "客户名称,必填",
"type": "string",
"maxLength": 200
},
"customer_type": {
"description": "客户类型,必填",
"type": "string",
"enum": [
"individual",
"enterprise",
"government",
"education"
]
},
"description": {
"description": "描述,可选",
"type": "string",
"maxLength": 1000
},
"email": {
"description": "邮箱,可选",
"type": "string",
"maxLength": 255
},
"phone": {
"description": "电话,可选",
"type": "string",
"maxLength": 20
},
"status": {
"description": "状态,必填",
"type": "string",
"enum": [
"active",
"disabled"
]
}
}
},
"models.CustomerInfoForAuthCode": {
"type": "object",
"properties": {
"created_at": {
"description": "客户创建时间",
"type": "string"
},
"customer_code": {
"description": "客户编号",
"type": "string"
},
"customer_name": {
"description": "客户名称",
"type": "string"
},
"customer_type": {
"description": "客户类型",
"type": "string"
},
"customer_type_display": {
"description": "客户类型显示(多语言)",
"type": "string"
},
"id": {
"description": "客户ID",
"type": "string"
},
"status": {
"description": "客户状态",
"type": "string"
},
"status_display": {
"description": "客户状态显示(多语言)",
"type": "string"
}
}
},
"models.CustomerListItem": {
"type": "object",
"properties": {
"contact_person": {
"type": "string"
},
"created_at": {
"type": "string"
},
"customer_code": {
"type": "string"
},
"customer_level": {
"type": "string"
},
"customer_level_display": {
"type": "string"
},
"customer_name": {
"type": "string"
},
"customer_type": {
"type": "string"
},
"customer_type_display": {
"type": "string"
},
"email": {
"type": "string"
},
"id": {
"type": "string"
},
"status": {
"type": "string"
},
"status_display": {
"type": "string"
}
}
},
"models.CustomerListResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/models.CustomerListItem"
}
},
"page": {
"type": "integer"
},
"page_size": {
"type": "integer"
},
"total": {
"type": "integer"
},
"total_pages": {
"type": "integer"
}
}
},
"models.CustomerStatusUpdateRequest": {
"type": "object",
"required": [
"status"
],
"properties": {
"status": {
"description": "状态,必填",
"type": "string",
"enum": [
"active",
"disabled"
]
}
}
},
"models.CustomerUpdateRequest": {
"type": "object",
"properties": {
"address": {
"description": "地址,可选",
"type": "string",
"maxLength": 500
},
"company_size": {
"description": "企业规模,可选",
"type": "string"
},
"contact_person": {
"description": "联系人姓名,可选",
"type": "string",
"maxLength": 100
},
"contact_title": {
"description": "联系人职位,可选",
"type": "string",
"maxLength": 100
},
"customer_level": {
"description": "客户等级,可选",
"type": "string"
},
"customer_name": {
"description": "客户名称,可选",
"type": "string",
"maxLength": 200
},
"customer_type": {
"description": "客户类型,可选",
"type": "string",
"enum": [
"individual",
"enterprise",
"government",
"education"
]
},
"description": {
"description": "描述,可选",
"type": "string",
"maxLength": 1000
},
"email": {
"description": "邮箱,可选",
"type": "string",
"maxLength": 255
},
"phone": {
"description": "电话,可选",
"type": "string",
"maxLength": 20
},
"status": {
"description": "状态,可选",
"type": "string",
"enum": [
"active",
"disabled"
]
}
}
},
"models.DashboardAuthorizationTrendResponse": {
"type": "object",
"properties": {
"period": {
"description": "时间段信息",
"allOf": [
{
"$ref": "#/definitions/models.TrendPeriod"
}
]
},
"summary": {
"description": "汇总信息",
"allOf": [
{
"$ref": "#/definitions/models.TrendSummary"
}
]
},
"trend_data": {
"description": "趋势数据",
"type": "array",
"items": {
"$ref": "#/definitions/models.TrendData"
}
}
}
},
"models.DashboardRecentAuthorizationsResponse": {
"type": "object",
"properties": {
"list": {
"description": "授权列表",
"type": "array",
"items": {
"$ref": "#/definitions/models.RecentAuthorization"
}
},
"total": {
"description": "符合条件的授权总数量",
"type": "integer"
}
}
},
"models.EnumItem": {
"type": "object",
"properties": {
"display": {
"description": "多语言显示文本",
"type": "string"
},
"key": {
"description": "枚举值",
"type": "string"
}
}
},
"models.EnumListResponse": {
"type": "object",
"properties": {
"enums": {
"description": "所有枚举类型",
"type": "array",
"items": {
"$ref": "#/definitions/models.EnumTypeResponse"
}
}
}
},
"models.EnumTypeResponse": {
"type": "object",
"properties": {
"items": {
"description": "枚举项列表",
"type": "array",
"items": {
"$ref": "#/definitions/models.EnumItem"
}
},
"type": {
"description": "枚举类型名称",
"type": "string"
}
}
},
"models.ErrorResponse": {
"type": "object",
"properties": {
"code": {
"description": "业务错误码,如 \"100001\", \"900001\"",
"type": "string"
},
"message": {
"description": "错误描述信息",
"type": "string"
},
"timestamp": {
"description": "错误发生时间",
"type": "string"
}
}
},
"models.GrowthRate": {
"type": "object",
"properties": {
"auth_codes": {
"description": "授权码增长率(%)(当前总授权码数相比一个月前总授权码数的增长率)",
"type": "number"
},
"licenses": {
"description": "许可证增长率(%)(当前活跃许可证数相比一个月前活跃许可证数的增长率)",
"type": "number"
}
}
},
"models.HealthResponse": {
"type": "object",
"properties": {
"services": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"status": {
"type": "string"
},
"system": {
"$ref": "#/definitions/models.SystemInfo"
},
"timestamp": {
"type": "string"
},
"uptime": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"models.HeartbeatRequest": {
"type": "object",
"required": [
"hardware_fingerprint",
"license_key"
],
"properties": {
"config_updated_at": {
"description": "客户端配置更新时间,可选",
"type": "string"
},
"hardware_fingerprint": {
"description": "硬件指纹,必填",
"type": "string"
},
"license_key": {
"description": "许可证密钥,必填",
"type": "string"
},
"software_version": {
"description": "软件版本,可选",
"type": "string"
},
"usage_data": {
"description": "使用数据,可选",
"type": "object",
"additionalProperties": true
}
}
},
"models.HeartbeatResponse": {
"type": "object",
"properties": {
"config_updated": {
"description": "配置是否有更新",
"type": "boolean"
},
"heartbeat_interval": {
"description": "下次心跳间隔(秒)",
"type": "integer"
},
"license_file": {
"description": "base64编码的新许可证文件(如有更新)",
"type": "string"
},
"status": {
"description": "许可证状态",
"type": "string"
}
}
},
"models.License": {
"type": "object",
"properties": {
"activated_at": {
"type": "string"
},
"activation_ip": {
"type": "string"
},
"authorization_code": {
"description": "关联字段(用于查询时的JOIN)",
"allOf": [
{
"$ref": "#/definitions/models.AuthorizationCode"
}
]
},
"authorization_code_id": {
"type": "string"
},
"config_updated_at": {
"type": "string"
},
"created_at": {
"type": "string"
},
"customer": {
"$ref": "#/definitions/models.Customer"
},
"customer_id": {
"type": "string"
},
"device_info": {
"type": "object"
},
"hardware_fingerprint": {
"type": "string"
},
"id": {
"type": "string"
},
"is_online": {
"type": "boolean"
},
"is_online_display": {
"type": "string"
},
"last_heartbeat": {
"type": "string"
},
"last_online_ip": {
"type": "string"
},
"license_key": {
"type": "string"
},
"status": {
"type": "string"
},
"status_display": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"usage_data": {
"type": "object"
}
}
},
"models.LicenseCreateRequest": {
"type": "object",
"required": [
"authorization_code_id",
"hardware_fingerprint"
],
"properties": {
"activation_ip": {
"description": "激活IP,可选",
"type": "string"
},
"authorization_code_id": {
"description": "授权码ID,必填",
"type": "string"
},
"device_info": {
"description": "设备信息,可选",
"type": "object",
"additionalProperties": true
},
"hardware_fingerprint": {
"description": "硬件指纹,必填",
"type": "string"
}
}
},
"models.LicenseDetailResponse": {
"type": "object",
"properties": {
"activated_at": {
"description": "激活时间",
"type": "string"
},
"activation_ip": {
"description": "激活IP",
"type": "string"
},
"authorization_code": {
"description": "授权码",
"type": "string"
},
"authorization_code_id": {
"description": "授权码ID",
"type": "string"
},
"config_updated_at": {
"description": "客户端配置更新时间",
"type": "string"
},
"created_at": {
"description": "创建时间",
"type": "string"
},
"customer_id": {
"description": "客户ID",
"type": "string"
},
"customer_name": {
"description": "客户名称",
"type": "string"
},
"device_info": {
"description": "设备信息",
"type": "object",
"additionalProperties": true
},
"hardware_fingerprint": {
"description": "硬件指纹",
"type": "string"
},
"id": {
"description": "许可证ID",
"type": "string"
},
"is_online": {
"description": "是否在线",
"type": "boolean"
},
"is_online_display": {
"description": "在线状态显示名称",
"type": "string"
},
"last_heartbeat": {
"description": "最后心跳时间",
"type": "string"
},
"last_online_ip": {
"description": "最后在线IP",
"type": "string"
},
"license_key": {
"description": "许可证密钥",
"type": "string"
},
"status": {
"description": "许可证状态",
"type": "string"
},
"status_display": {
"description": "状态显示名称",
"type": "string"
},
"updated_at": {
"description": "更新时间",
"type": "string"
},
"usage_data": {
"description": "使用数据",
"type": "object",
"additionalProperties": true
}
}
},
"models.LicenseListItem": {
"type": "object",
"properties": {
"activated_at": {
"description": "激活时间",
"type": "string"
},
"activation_ip": {
"description": "激活IP",
"type": "string"
},
"authorization_code": {
"description": "授权码",
"type": "string"
},
"authorization_code_id": {
"description": "授权码ID",
"type": "string"
},
"customer_name": {
"description": "客户名称",
"type": "string"
},
"hardware_fingerprint": {
"description": "硬件指纹",
"type": "string"
},
"id": {
"description": "许可证ID",
"type": "string"
},
"is_online": {
"description": "是否在线",
"type": "boolean"
},
"is_online_display": {
"description": "在线状态显示名称",
"type": "string"
},
"last_heartbeat": {
"description": "最后心跳时间",
"type": "string"
},
"last_online_ip": {
"description": "最后在线IP",
"type": "string"
},
"license_key": {
"description": "许可证密钥",
"type": "string"
},
"status": {
"description": "许可证状态",
"type": "string"
},
"status_display": {
"description": "状态显示名称",
"type": "string"
}
}
},
"models.LicenseListResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/models.LicenseListItem"
}
},
"page": {
"type": "integer"
},
"page_size": {
"type": "integer"
},
"total": {
"type": "integer"
},
"total_pages": {
"type": "integer"
}
}
},
"models.LicenseRevokeRequest": {
"type": "object",
"properties": {
"reason": {
"description": "撤销原因,可选",
"type": "string",
"maxLength": 500
}
}
},
"models.LoginRequest": {
"type": "object",
"required": [
"password",
"username"
],
"properties": {
"password": {
"description": "密码",
"type": "string"
},
"username": {
"description": "用户名",
"type": "string"
}
}
},
"models.LoginResponse": {
"type": "object",
"properties": {
"code": {
"description": "响应代码",
"type": "string"
},
"data": {
"description": "响应数据"
},
"message": {
"description": "响应消息",
"type": "string"
}
}
},
"models.RecentAuthorization": {
"type": "object",
"properties": {
"code": {
"description": "授权码",
"type": "string"
},
"created_at": {
"description": "创建时间",
"type": "string"
},
"current_activations": {
"description": "当前激活数量",
"type": "integer"
},
"customer_id": {
"description": "客户ID",
"type": "string"
},
"customer_name": {
"description": "客户名称",
"type": "string"
},
"description": {
"description": "授权描述",
"type": "string"
},
"end_date": {
"description": "到期时间",
"type": "string"
},
"id": {
"description": "授权码ID",
"type": "string"
},
"max_activations": {
"description": "最大激活数量",
"type": "integer"
},
"start_date": {
"description": "生效时间",
"type": "string"
},
"status": {
"description": "状态 (normal/locked/expired)",
"type": "string"
},
"status_display": {
"description": "状态显示文本(多语言)",
"type": "string"
},
"updated_at": {
"description": "更新时间",
"type": "string"
}
}
},
"models.StatsOverviewResponse": {
"type": "object",
"properties": {
"abnormal_alerts": {
"description": "异常告警数量(活跃许可证中心跳超时的数量,超过配置的心跳超时时间未收到心跳)",
"type": "integer"
},
"active_licenses": {
"description": "活跃许可证数量(状态为active的许可证总数)",
"type": "integer"
},
"expiring_soon": {
"description": "即将过期数量(30天内即将过期的授权码,且未被锁定)",
"type": "integer"
},
"growth_rate": {
"description": "增长率(同比上月)",
"allOf": [
{
"$ref": "#/definitions/models.GrowthRate"
}
]
},
"total_auth_codes": {
"description": "总授权码数量(所有授权码的累计总数)",
"type": "integer"
}
}
},
"models.SystemInfo": {
"type": "object",
"properties": {
"arch": {
"type": "string"
},
"num_cpu": {
"type": "integer"
},
"num_goroutine": {
"type": "integer"
},
"os": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"models.TrendData": {
"type": "object",
"properties": {
"date": {
"description": "日期 (YYYY-MM-DD)",
"type": "string"
},
"expired_authorizations": {
"description": "当日过期授权数",
"type": "integer"
},
"new_authorizations": {
"description": "当日新增授权数",
"type": "integer"
},
"total_authorizations": {
"description": "当日授权总数",
"type": "integer"
}
}
},
"models.TrendPeriod": {
"type": "object",
"properties": {
"description_display": {
"description": "多语言描述",
"type": "string"
},
"end_date": {
"description": "结束日期",
"type": "string"
},
"start_date": {
"description": "开始日期",
"type": "string"
},
"type": {
"description": "时间类型",
"type": "string"
}
}
},
"models.TrendSummary": {
"type": "object",
"properties": {
"expired_count": {
"description": "期间过期授权数",
"type": "integer"
},
"growth_rate": {
"description": "增长率(百分比)",
"type": "number"
},
"new_count": {
"description": "期间新增授权数",
"type": "integer"
},
"total_count": {
"description": "期间总授权数",
"type": "integer"
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"description": "Bearer token for authentication",
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "",
BasePath: "/",
Schemes: []string{"http", "https"},
Title: "License Manager API",
Description: "软件授权管理平台API文档",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}