{ "schemes": [ "http", "https" ], "swagger": "2.0", "info": { "description": "软件授权管理平台API文档(精简版,仅包含激活与心跳接口)", "title": "License Manager API", "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": "1.0" }, "basePath": "/", "paths": { "/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/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" } } } } } }, "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.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.ErrorResponse": { "type": "object", "properties": { "code": { "description": "业务错误码,如 \"100001\", \"900001\"", "type": "string" }, "message": { "description": "错误描述信息", "type": "string" }, "timestamp": { "description": "错误发生时间", "type": "string" } } } }, "securityDefinitions": { "BearerAuth": { "description": "Bearer token for authentication", "type": "apiKey", "name": "Authorization", "in": "header" } } }