feat: 授权详情接口增加客户信息、许可证数量
This commit is contained in:
1 parent
e3068ec1fa
commit
5cea6aa87a
8 files changed
+692
-112
No files matched your search
@@ -149,7 +149,6 @@ GET /api/v1/authorization-codes/{id}
|
||||
"id": "uuid-string",
|
||||
"code": "LIC-COMP001-A7B9X2-C8F4",
|
||||
"customer_id": "customer-uuid",
|
||||
"customer_name": "张三公司",
|
||||
"status": "normal",
|
||||
"status_display": "正常",
|
||||
"start_date": "2024-01-01T00:00:00Z",
|
||||
@@ -172,7 +171,18 @@ GET /api/v1/authorization-codes/{id}
|
||||
"lock_reason": null,
|
||||
"description": "企业版授权",
|
||||
"created_at": "2024-01-01T10:00:00Z",
|
||||
"updated_at": "2024-01-01T10:00:00Z"
|
||||
"updated_at": "2024-01-01T10:00:00Z",
|
||||
"customer_info": {
|
||||
"id": "customer-uuid",
|
||||
"customer_code": "CUS-2024-0001",
|
||||
"customer_name": "张三公司",
|
||||
"customer_type": "enterprise",
|
||||
"customer_type_display": "企业客户",
|
||||
"status": "active",
|
||||
"status_display": "激活",
|
||||
"created_at": "2023-12-01T10:00:00Z"
|
||||
},
|
||||
"activated_licenses_count": 7
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -2346,24 +2346,31 @@ const docTemplate = `{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -2372,21 +2379,26 @@ const docTemplate = `{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -2394,88 +2406,128 @@ const docTemplate = `{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -2489,11 +2541,15 @@ const docTemplate = `{
|
||||
"validity_days"
|
||||
],
|
||||
"properties": {
|
||||
"custom_parameters": {},
|
||||
"custom_parameters": {
|
||||
"description": "自定义参数(JSON对象)"
|
||||
},
|
||||
"customer_id": {
|
||||
"description": "客户ID",
|
||||
"type": "string"
|
||||
},
|
||||
"deployment_type": {
|
||||
"description": "部署类型:standalone/cloud/hybrid",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"standalone",
|
||||
@@ -2502,29 +2558,39 @@ const docTemplate = `{
|
||||
]
|
||||
},
|
||||
"description": {
|
||||
"description": "描述",
|
||||
"type": "string",
|
||||
"maxLength": 1000
|
||||
},
|
||||
"encryption_type": {
|
||||
"description": "加密类型:standard/advanced",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"standard",
|
||||
"advanced"
|
||||
]
|
||||
},
|
||||
"feature_config": {},
|
||||
"feature_config": {
|
||||
"description": "功能配置(JSON对象)"
|
||||
},
|
||||
"max_activations": {
|
||||
"description": "最大激活次数",
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"software_id": {
|
||||
"description": "软件ID",
|
||||
"type": "string"
|
||||
},
|
||||
"software_version": {
|
||||
"description": "软件版本",
|
||||
"type": "string"
|
||||
},
|
||||
"usage_limits": {},
|
||||
"usage_limits": {
|
||||
"description": "使用限制(JSON对象)"
|
||||
},
|
||||
"validity_days": {
|
||||
"description": "有效天数(1-36500天)",
|
||||
"type": "integer",
|
||||
"maximum": 36500,
|
||||
"minimum": 1
|
||||
@@ -2535,9 +2601,11 @@ const docTemplate = `{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"description": "授权码",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "授权码ID",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@@ -2546,51 +2614,67 @@ const docTemplate = `{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -2599,21 +2683,26 @@ const docTemplate = `{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -2644,6 +2733,7 @@ const docTemplate = `{
|
||||
],
|
||||
"properties": {
|
||||
"change_type": {
|
||||
"description": "变更类型:renewal/upgrade/limit_change/feature_toggle/lock/unlock/other",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"renewal",
|
||||
@@ -2655,8 +2745,11 @@ const docTemplate = `{
|
||||
"other"
|
||||
]
|
||||
},
|
||||
"custom_parameters": {},
|
||||
"custom_parameters": {
|
||||
"description": "自定义参数"
|
||||
},
|
||||
"deployment_type": {
|
||||
"description": "部署类型:standalone/cloud/hybrid",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"standalone",
|
||||
@@ -2665,33 +2758,44 @@ const docTemplate = `{
|
||||
]
|
||||
},
|
||||
"description": {
|
||||
"description": "描述",
|
||||
"type": "string",
|
||||
"maxLength": 1000
|
||||
},
|
||||
"encryption_type": {
|
||||
"description": "加密类型:standard/advanced",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"standard",
|
||||
"advanced"
|
||||
]
|
||||
},
|
||||
"feature_config": {},
|
||||
"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": {},
|
||||
"usage_limits": {
|
||||
"description": "使用限制"
|
||||
},
|
||||
"validity_days": {
|
||||
"description": "有效天数",
|
||||
"type": "integer",
|
||||
"maximum": 36500,
|
||||
"minimum": 1
|
||||
@@ -2851,6 +2955,43 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
@@ -3301,64 +3442,84 @@ const docTemplate = `{
|
||||
"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
|
||||
}
|
||||
@@ -3368,45 +3529,59 @@ const docTemplate = `{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -3452,9 +3627,11 @@ const docTemplate = `{
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"description": "密码",
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"description": "用户名",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@@ -3463,10 +3640,14 @@ const docTemplate = `{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"description": "响应代码",
|
||||
"type": "string"
|
||||
},
|
||||
"data": {},
|
||||
"data": {
|
||||
"description": "响应数据"
|
||||
},
|
||||
"message": {
|
||||
"description": "响应消息",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2343,24 +2343,31 @@
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -2369,21 +2376,26 @@
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -2391,88 +2403,128 @@
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -2486,11 +2538,15 @@
|
||||
"validity_days"
|
||||
],
|
||||
"properties": {
|
||||
"custom_parameters": {},
|
||||
"custom_parameters": {
|
||||
"description": "自定义参数(JSON对象)"
|
||||
},
|
||||
"customer_id": {
|
||||
"description": "客户ID",
|
||||
"type": "string"
|
||||
},
|
||||
"deployment_type": {
|
||||
"description": "部署类型:standalone/cloud/hybrid",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"standalone",
|
||||
@@ -2499,29 +2555,39 @@
|
||||
]
|
||||
},
|
||||
"description": {
|
||||
"description": "描述",
|
||||
"type": "string",
|
||||
"maxLength": 1000
|
||||
},
|
||||
"encryption_type": {
|
||||
"description": "加密类型:standard/advanced",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"standard",
|
||||
"advanced"
|
||||
]
|
||||
},
|
||||
"feature_config": {},
|
||||
"feature_config": {
|
||||
"description": "功能配置(JSON对象)"
|
||||
},
|
||||
"max_activations": {
|
||||
"description": "最大激活次数",
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"software_id": {
|
||||
"description": "软件ID",
|
||||
"type": "string"
|
||||
},
|
||||
"software_version": {
|
||||
"description": "软件版本",
|
||||
"type": "string"
|
||||
},
|
||||
"usage_limits": {},
|
||||
"usage_limits": {
|
||||
"description": "使用限制(JSON对象)"
|
||||
},
|
||||
"validity_days": {
|
||||
"description": "有效天数(1-36500天)",
|
||||
"type": "integer",
|
||||
"maximum": 36500,
|
||||
"minimum": 1
|
||||
@@ -2532,9 +2598,11 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"description": "授权码",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "授权码ID",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@@ -2543,51 +2611,67 @@
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -2596,21 +2680,26 @@
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -2641,6 +2730,7 @@
|
||||
],
|
||||
"properties": {
|
||||
"change_type": {
|
||||
"description": "变更类型:renewal/upgrade/limit_change/feature_toggle/lock/unlock/other",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"renewal",
|
||||
@@ -2652,8 +2742,11 @@
|
||||
"other"
|
||||
]
|
||||
},
|
||||
"custom_parameters": {},
|
||||
"custom_parameters": {
|
||||
"description": "自定义参数"
|
||||
},
|
||||
"deployment_type": {
|
||||
"description": "部署类型:standalone/cloud/hybrid",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"standalone",
|
||||
@@ -2662,33 +2755,44 @@
|
||||
]
|
||||
},
|
||||
"description": {
|
||||
"description": "描述",
|
||||
"type": "string",
|
||||
"maxLength": 1000
|
||||
},
|
||||
"encryption_type": {
|
||||
"description": "加密类型:standard/advanced",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"standard",
|
||||
"advanced"
|
||||
]
|
||||
},
|
||||
"feature_config": {},
|
||||
"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": {},
|
||||
"usage_limits": {
|
||||
"description": "使用限制"
|
||||
},
|
||||
"validity_days": {
|
||||
"description": "有效天数",
|
||||
"type": "integer",
|
||||
"maximum": 36500,
|
||||
"minimum": 1
|
||||
@@ -2848,6 +2952,43 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
@@ -3298,64 +3439,84 @@
|
||||
"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
|
||||
}
|
||||
@@ -3365,45 +3526,59 @@
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -3449,9 +3624,11 @@
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"description": "密码",
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"description": "用户名",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@@ -3460,10 +3637,14 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"description": "响应代码",
|
||||
"type": "string"
|
||||
},
|
||||
"data": {},
|
||||
"data": {
|
||||
"description": "响应数据"
|
||||
},
|
||||
"message": {
|
||||
"description": "响应消息",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,123 +44,181 @@ definitions:
|
||||
models.AuthorizationChangeListItem:
|
||||
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
|
||||
type: object
|
||||
models.AuthorizationChangeListResponse:
|
||||
properties:
|
||||
list:
|
||||
description: 变更历史列表
|
||||
items:
|
||||
$ref: '#/definitions/models.AuthorizationChangeListItem'
|
||||
type: array
|
||||
page:
|
||||
description: 当前页码
|
||||
type: integer
|
||||
page_size:
|
||||
description: 每页条数
|
||||
type: integer
|
||||
total:
|
||||
description: 总记录数
|
||||
type: integer
|
||||
total_pages:
|
||||
description: 总页数
|
||||
type: integer
|
||||
type: object
|
||||
models.AuthorizationCode:
|
||||
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:
|
||||
allOf:
|
||||
- $ref: '#/definitions/models.CustomerInfoForAuthCode'
|
||||
description: 客户信息(仅在详情接口返回)
|
||||
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
|
||||
type: object
|
||||
models.AuthorizationCodeCreateRequest:
|
||||
properties:
|
||||
custom_parameters: {}
|
||||
custom_parameters:
|
||||
description: 自定义参数(JSON对象)
|
||||
customer_id:
|
||||
description: 客户ID
|
||||
type: string
|
||||
deployment_type:
|
||||
description: 部署类型:standalone/cloud/hybrid
|
||||
enum:
|
||||
- standalone
|
||||
- cloud
|
||||
- hybrid
|
||||
type: string
|
||||
description:
|
||||
description: 描述
|
||||
maxLength: 1000
|
||||
type: string
|
||||
encryption_type:
|
||||
description: 加密类型:standard/advanced
|
||||
enum:
|
||||
- standard
|
||||
- advanced
|
||||
type: string
|
||||
feature_config: {}
|
||||
feature_config:
|
||||
description: 功能配置(JSON对象)
|
||||
max_activations:
|
||||
description: 最大激活次数
|
||||
minimum: 1
|
||||
type: integer
|
||||
software_id:
|
||||
description: 软件ID
|
||||
type: string
|
||||
software_version:
|
||||
description: 软件版本
|
||||
type: string
|
||||
usage_limits: {}
|
||||
usage_limits:
|
||||
description: 使用限制(JSON对象)
|
||||
validity_days:
|
||||
description: 有效天数(1-36500天)
|
||||
maximum: 36500
|
||||
minimum: 1
|
||||
type: integer
|
||||
@@ -173,58 +231,81 @@ definitions:
|
||||
models.AuthorizationCodeCreateResponse:
|
||||
properties:
|
||||
code:
|
||||
description: 授权码
|
||||
type: string
|
||||
id:
|
||||
description: 授权码ID
|
||||
type: string
|
||||
type: object
|
||||
models.AuthorizationCodeListItem:
|
||||
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
|
||||
type: object
|
||||
models.AuthorizationCodeListResponse:
|
||||
properties:
|
||||
list:
|
||||
description: 授权码列表
|
||||
items:
|
||||
$ref: '#/definitions/models.AuthorizationCodeListItem'
|
||||
type: array
|
||||
page:
|
||||
description: 当前页码
|
||||
type: integer
|
||||
page_size:
|
||||
description: 每页条数
|
||||
type: integer
|
||||
total:
|
||||
description: 总记录数
|
||||
type: integer
|
||||
total_pages:
|
||||
description: 总页数
|
||||
type: integer
|
||||
type: object
|
||||
models.AuthorizationCodeLockRequest:
|
||||
@@ -244,6 +325,7 @@ definitions:
|
||||
models.AuthorizationCodeUpdateRequest:
|
||||
properties:
|
||||
change_type:
|
||||
description: 变更类型:renewal/upgrade/limit_change/feature_toggle/lock/unlock/other
|
||||
enum:
|
||||
- renewal
|
||||
- upgrade
|
||||
@@ -253,34 +335,45 @@ definitions:
|
||||
- unlock
|
||||
- other
|
||||
type: string
|
||||
custom_parameters: {}
|
||||
custom_parameters:
|
||||
description: 自定义参数
|
||||
deployment_type:
|
||||
description: 部署类型:standalone/cloud/hybrid
|
||||
enum:
|
||||
- standalone
|
||||
- cloud
|
||||
- hybrid
|
||||
type: string
|
||||
description:
|
||||
description: 描述
|
||||
maxLength: 1000
|
||||
type: string
|
||||
encryption_type:
|
||||
description: 加密类型:standard/advanced
|
||||
enum:
|
||||
- standard
|
||||
- advanced
|
||||
type: string
|
||||
feature_config: {}
|
||||
feature_config:
|
||||
description: 功能配置
|
||||
max_activations:
|
||||
description: 最大激活次数
|
||||
minimum: 1
|
||||
type: integer
|
||||
reason:
|
||||
description: 变更原因
|
||||
maxLength: 500
|
||||
type: string
|
||||
software_id:
|
||||
description: 软件ID
|
||||
type: string
|
||||
software_version:
|
||||
description: 软件版本
|
||||
type: string
|
||||
usage_limits: {}
|
||||
usage_limits:
|
||||
description: 使用限制
|
||||
validity_days:
|
||||
description: 有效天数
|
||||
maximum: 36500
|
||||
minimum: 1
|
||||
type: integer
|
||||
@@ -399,6 +492,33 @@ definitions:
|
||||
- customer_type
|
||||
- status
|
||||
type: object
|
||||
models.CustomerInfoForAuthCode:
|
||||
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
|
||||
type: object
|
||||
models.CustomerListItem:
|
||||
properties:
|
||||
contact_person:
|
||||
@@ -710,77 +830,111 @@ definitions:
|
||||
models.LicenseDetailResponse:
|
||||
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:
|
||||
additionalProperties: true
|
||||
description: 设备信息
|
||||
type: object
|
||||
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:
|
||||
additionalProperties: true
|
||||
description: 使用数据
|
||||
type: object
|
||||
type: object
|
||||
models.LicenseListItem:
|
||||
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
|
||||
type: object
|
||||
models.LicenseListResponse:
|
||||
@@ -808,8 +962,10 @@ definitions:
|
||||
models.LoginRequest:
|
||||
properties:
|
||||
password:
|
||||
description: 密码
|
||||
type: string
|
||||
username:
|
||||
description: 用户名
|
||||
type: string
|
||||
required:
|
||||
- password
|
||||
@@ -818,9 +974,12 @@ definitions:
|
||||
models.LoginResponse:
|
||||
properties:
|
||||
code:
|
||||
description: 响应代码
|
||||
type: string
|
||||
data: {}
|
||||
data:
|
||||
description: 响应数据
|
||||
message:
|
||||
description: 响应消息
|
||||
type: string
|
||||
type: object
|
||||
models.RecentAuthorization:
|
||||
|
||||
@@ -50,7 +50,7 @@ func SetupRouter() *gin.Engine {
|
||||
systemService := service.NewSystemService()
|
||||
customerService := service.NewCustomerService(customerRepo)
|
||||
enumService := service.NewEnumService()
|
||||
authCodeService := service.NewAuthorizationCodeService(authCodeRepo)
|
||||
authCodeService := service.NewAuthorizationCodeService(authCodeRepo, customerRepo, licenseRepo)
|
||||
licenseService := service.NewLicenseService(licenseRepo, db, log)
|
||||
dashboardService := service.NewDashboardService(dashboardRepo)
|
||||
|
||||
|
||||
@@ -59,10 +59,24 @@ type AuthorizationCode struct {
|
||||
FeatureConfig JSON `gorm:"type:json" json:"feature_config" swaggertype:"object"` // 功能配置(JSON对象)
|
||||
UsageLimits JSON `gorm:"type:json" json:"usage_limits" swaggertype:"object"` // 使用限制(JSON对象)
|
||||
CustomParameters JSON `gorm:"type:json" json:"custom_parameters" swaggertype:"object"` // 自定义参数(JSON对象)
|
||||
Status string `gorm:"-" json:"status,omitempty"` // 状态:normal/locked/expired
|
||||
StatusDisplay string `gorm:"-" json:"status_display,omitempty"` // 状态显示(多语言)
|
||||
CreatedAt time.Time `gorm:"type:datetime(3);not null" json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `gorm:"type:datetime(3);not null" json:"updated_at"` // 更新时间
|
||||
Status string `gorm:"-" json:"status,omitempty"` // 状态:normal/locked/expired
|
||||
StatusDisplay string `gorm:"-" json:"status_display,omitempty"` // 状态显示(多语言)
|
||||
CreatedAt time.Time `gorm:"type:datetime(3);not null" json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `gorm:"type:datetime(3);not null" json:"updated_at"` // 更新时间
|
||||
CustomerInfo *CustomerInfoForAuthCode `gorm:"-" json:"customer_info,omitempty"` // 客户信息(仅在详情接口返回)
|
||||
ActivatedLicensesCount int64 `gorm:"-" json:"activated_licenses_count,omitempty"` // 该授权码下已激活的许可证数量
|
||||
}
|
||||
|
||||
// CustomerInfoForAuthCode 授权码详情中的客户信息结构
|
||||
type CustomerInfoForAuthCode struct {
|
||||
ID string `json:"id"` // 客户ID
|
||||
CustomerCode string `json:"customer_code"` // 客户编号
|
||||
CustomerName string `json:"customer_name"` // 客户名称
|
||||
CustomerType string `json:"customer_type"` // 客户类型
|
||||
CustomerTypeDisplay string `json:"customer_type_display,omitempty"` // 客户类型显示(多语言)
|
||||
Status string `json:"status"` // 客户状态
|
||||
StatusDisplay string `json:"status_display,omitempty"` // 客户状态显示(多语言)
|
||||
CreatedAt string `json:"created_at"` // 客户创建时间
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
|
||||
@@ -9,29 +9,29 @@ import (
|
||||
|
||||
// License 许可证模型
|
||||
type License struct {
|
||||
ID string `gorm:"type:varchar(36);primaryKey" json:"id"`
|
||||
LicenseKey string `gorm:"type:varchar(200);uniqueIndex;not null" json:"license_key"`
|
||||
AuthorizationCodeID string `gorm:"type:varchar(36);not null;index" json:"authorization_code_id"`
|
||||
CustomerID string `gorm:"type:varchar(36);not null;index" json:"customer_id"`
|
||||
HardwareFingerprint string `gorm:"type:varchar(200);not null;index" json:"hardware_fingerprint"`
|
||||
DeviceInfo JSON `gorm:"type:json" json:"device_info,omitempty" swaggertype:"object"`
|
||||
ActivationIP *string `gorm:"type:varchar(45)" json:"activation_ip"`
|
||||
Status string `gorm:"type:varchar(20);not null;default:'inactive';index" json:"status"`
|
||||
StatusDisplay string `gorm:"-" json:"status_display,omitempty"`
|
||||
ActivatedAt *time.Time `gorm:"index" json:"activated_at"`
|
||||
LastHeartbeat *time.Time `gorm:"index" json:"last_heartbeat"`
|
||||
LastOnlineIP *string `gorm:"type:varchar(45)" json:"last_online_ip"`
|
||||
ConfigUpdatedAt *time.Time `gorm:"index" json:"config_updated_at"`
|
||||
UsageData JSON `gorm:"type:json" json:"usage_data,omitempty" swaggertype:"object"`
|
||||
CreatedAt time.Time `gorm:"not null;index" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"not null" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
ID string `gorm:"type:varchar(36);primaryKey" json:"id"`
|
||||
LicenseKey string `gorm:"type:varchar(200);uniqueIndex;not null" json:"license_key"`
|
||||
AuthorizationCodeID string `gorm:"type:varchar(36);not null;index" json:"authorization_code_id"`
|
||||
CustomerID string `gorm:"type:varchar(36);not null;index" json:"customer_id"`
|
||||
HardwareFingerprint string `gorm:"type:varchar(200);not null;index" json:"hardware_fingerprint"`
|
||||
DeviceInfo JSON `gorm:"type:json" json:"device_info,omitempty" swaggertype:"object"`
|
||||
ActivationIP *string `gorm:"type:varchar(45)" json:"activation_ip"`
|
||||
Status string `gorm:"type:varchar(20);not null;default:'inactive';index" json:"status"`
|
||||
StatusDisplay string `gorm:"-" json:"status_display,omitempty"`
|
||||
ActivatedAt *time.Time `gorm:"index" json:"activated_at"`
|
||||
LastHeartbeat *time.Time `gorm:"index" json:"last_heartbeat"`
|
||||
LastOnlineIP *string `gorm:"type:varchar(45)" json:"last_online_ip"`
|
||||
ConfigUpdatedAt *time.Time `gorm:"index" json:"config_updated_at"`
|
||||
UsageData JSON `gorm:"type:json" json:"usage_data,omitempty" swaggertype:"object"`
|
||||
CreatedAt time.Time `gorm:"not null;index" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"not null" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
|
||||
// 关联字段(用于查询时的JOIN)
|
||||
AuthorizationCode *AuthorizationCode `gorm:"foreignKey:AuthorizationCodeID" json:"authorization_code,omitempty"`
|
||||
Customer *Customer `gorm:"foreignKey:CustomerID" json:"customer,omitempty"`
|
||||
IsOnline bool `gorm:"-" json:"is_online"`
|
||||
IsOnlineDisplay string `gorm:"-" json:"is_online_display,omitempty"`
|
||||
AuthorizationCode *AuthorizationCode `gorm:"foreignKey:AuthorizationCodeID" json:"authorization_code,omitempty"`
|
||||
Customer *Customer `gorm:"foreignKey:CustomerID" json:"customer,omitempty"`
|
||||
IsOnline bool `gorm:"-" json:"is_online"`
|
||||
IsOnlineDisplay string `gorm:"-" json:"is_online_display,omitempty"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
@@ -44,7 +44,7 @@ func (l *License) BeforeCreate(tx *gorm.DB) error {
|
||||
if l.ID == "" {
|
||||
l.ID = uuid.New().String()
|
||||
}
|
||||
|
||||
|
||||
now := time.Now()
|
||||
if l.CreatedAt.IsZero() {
|
||||
l.CreatedAt = now
|
||||
@@ -63,32 +63,32 @@ func (l *License) BeforeUpdate(tx *gorm.DB) error {
|
||||
|
||||
// LicenseListRequest 许可证列表查询请求结构
|
||||
type LicenseListRequest struct {
|
||||
Page int `form:"page" binding:"omitempty,min=1"` // 页码,默认1
|
||||
PageSize int `form:"page_size" binding:"omitempty,min=1,max=100"` // 每页条数,默认20,最大100
|
||||
AuthorizationCodeID string `form:"authorization_code_id" binding:"omitempty"` // 授权码ID筛选
|
||||
CustomerID string `form:"customer_id" binding:"omitempty"` // 客户ID筛选
|
||||
Status string `form:"status" binding:"omitempty,oneof=active inactive revoked"` // 状态筛选
|
||||
IsOnline *bool `form:"is_online" binding:"omitempty"` // 在线状态筛选
|
||||
Sort string `form:"sort" binding:"omitempty,oneof=created_at updated_at activated_at last_heartbeat"` // 排序字段,默认created_at
|
||||
Order string `form:"order" binding:"omitempty,oneof=asc desc"` // 排序方向,默认desc
|
||||
Page int `form:"page" binding:"omitempty,min=1"` // 页码,默认1
|
||||
PageSize int `form:"page_size" binding:"omitempty,min=1,max=100"` // 每页条数,默认20,最大100
|
||||
AuthorizationCodeID string `form:"authorization_code_id" binding:"omitempty"` // 授权码ID筛选
|
||||
CustomerID string `form:"customer_id" binding:"omitempty"` // 客户ID筛选
|
||||
Status string `form:"status" binding:"omitempty,oneof=active inactive revoked"` // 状态筛选
|
||||
IsOnline *bool `form:"is_online" binding:"omitempty"` // 在线状态筛选
|
||||
Sort string `form:"sort" binding:"omitempty,oneof=created_at updated_at activated_at last_heartbeat"` // 排序字段,默认created_at
|
||||
Order string `form:"order" binding:"omitempty,oneof=asc desc"` // 排序方向,默认desc
|
||||
}
|
||||
|
||||
// LicenseListItem 许可证列表项结构
|
||||
type LicenseListItem struct {
|
||||
ID string `json:"id"`
|
||||
LicenseKey string `json:"license_key"`
|
||||
AuthorizationCodeID string `json:"authorization_code_id"`
|
||||
AuthorizationCode string `json:"authorization_code"`
|
||||
CustomerName string `json:"customer_name"`
|
||||
HardwareFingerprint string `json:"hardware_fingerprint"`
|
||||
Status string `json:"status"`
|
||||
StatusDisplay string `json:"status_display,omitempty"`
|
||||
IsOnline bool `json:"is_online"`
|
||||
IsOnlineDisplay string `json:"is_online_display,omitempty"`
|
||||
ActivationIP *string `json:"activation_ip"`
|
||||
LastOnlineIP *string `json:"last_online_ip"`
|
||||
ActivatedAt *string `json:"activated_at"`
|
||||
LastHeartbeat *string `json:"last_heartbeat"`
|
||||
ID string `json:"id"` // 许可证ID
|
||||
LicenseKey string `json:"license_key"` // 许可证密钥
|
||||
AuthorizationCodeID string `json:"authorization_code_id"` // 授权码ID
|
||||
AuthorizationCode string `json:"authorization_code"` // 授权码
|
||||
CustomerName string `json:"customer_name"` // 客户名称
|
||||
HardwareFingerprint string `json:"hardware_fingerprint"` // 硬件指纹
|
||||
Status string `json:"status"` // 许可证状态
|
||||
StatusDisplay string `json:"status_display,omitempty"` // 状态显示名称
|
||||
IsOnline bool `json:"is_online"` // 是否在线
|
||||
IsOnlineDisplay string `json:"is_online_display,omitempty"` // 在线状态显示名称
|
||||
ActivationIP *string `json:"activation_ip"` // 激活IP
|
||||
LastOnlineIP *string `json:"last_online_ip"` // 最后在线IP
|
||||
ActivatedAt *string `json:"activated_at"` // 激活时间
|
||||
LastHeartbeat *string `json:"last_heartbeat"` // 最后心跳时间
|
||||
}
|
||||
|
||||
// LicenseListResponse 许可证列表响应结构
|
||||
@@ -102,34 +102,34 @@ type LicenseListResponse struct {
|
||||
|
||||
// LicenseDetailResponse 许可证详情响应结构
|
||||
type LicenseDetailResponse struct {
|
||||
ID string `json:"id"`
|
||||
LicenseKey string `json:"license_key"`
|
||||
AuthorizationCodeID string `json:"authorization_code_id"`
|
||||
AuthorizationCode string `json:"authorization_code"`
|
||||
CustomerID string `json:"customer_id"`
|
||||
CustomerName string `json:"customer_name"`
|
||||
HardwareFingerprint string `json:"hardware_fingerprint"`
|
||||
DeviceInfo map[string]interface{} `json:"device_info,omitempty"`
|
||||
ActivationIP *string `json:"activation_ip"`
|
||||
Status string `json:"status"`
|
||||
StatusDisplay string `json:"status_display,omitempty"`
|
||||
IsOnline bool `json:"is_online"`
|
||||
IsOnlineDisplay string `json:"is_online_display,omitempty"`
|
||||
ActivatedAt *string `json:"activated_at"`
|
||||
LastHeartbeat *string `json:"last_heartbeat"`
|
||||
LastOnlineIP *string `json:"last_online_ip"`
|
||||
ConfigUpdatedAt *string `json:"config_updated_at"`
|
||||
UsageData map[string]interface{} `json:"usage_data,omitempty"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
ID string `json:"id"` // 许可证ID
|
||||
LicenseKey string `json:"license_key"` // 许可证密钥
|
||||
AuthorizationCodeID string `json:"authorization_code_id"` // 授权码ID
|
||||
AuthorizationCode string `json:"authorization_code"` // 授权码
|
||||
CustomerID string `json:"customer_id"` // 客户ID
|
||||
CustomerName string `json:"customer_name"` // 客户名称
|
||||
HardwareFingerprint string `json:"hardware_fingerprint"` // 硬件指纹
|
||||
DeviceInfo map[string]interface{} `json:"device_info,omitempty"` // 设备信息
|
||||
ActivationIP *string `json:"activation_ip"` // 激活IP
|
||||
Status string `json:"status"` // 许可证状态
|
||||
StatusDisplay string `json:"status_display,omitempty"` // 状态显示名称
|
||||
IsOnline bool `json:"is_online"` // 是否在线
|
||||
IsOnlineDisplay string `json:"is_online_display,omitempty"` // 在线状态显示名称
|
||||
ActivatedAt *string `json:"activated_at"` // 激活时间
|
||||
LastHeartbeat *string `json:"last_heartbeat"` // 最后心跳时间
|
||||
LastOnlineIP *string `json:"last_online_ip"` // 最后在线IP
|
||||
ConfigUpdatedAt *string `json:"config_updated_at"` // 客户端配置更新时间
|
||||
UsageData map[string]interface{} `json:"usage_data,omitempty"` // 使用数据
|
||||
CreatedAt string `json:"created_at"` // 创建时间
|
||||
UpdatedAt string `json:"updated_at"` // 更新时间
|
||||
}
|
||||
|
||||
// LicenseCreateRequest 手动添加许可证请求结构
|
||||
type LicenseCreateRequest struct {
|
||||
AuthorizationCodeID string `json:"authorization_code_id" binding:"required"` // 授权码ID,必填
|
||||
HardwareFingerprint string `json:"hardware_fingerprint" binding:"required"` // 硬件指纹,必填
|
||||
DeviceInfo map[string]interface{} `json:"device_info,omitempty"` // 设备信息,可选
|
||||
ActivationIP *string `json:"activation_ip" binding:"omitempty,ip"` // 激活IP,可选
|
||||
AuthorizationCodeID string `json:"authorization_code_id" binding:"required"` // 授权码ID,必填
|
||||
HardwareFingerprint string `json:"hardware_fingerprint" binding:"required"` // 硬件指纹,必填
|
||||
DeviceInfo map[string]interface{} `json:"device_info,omitempty"` // 设备信息,可选
|
||||
ActivationIP *string `json:"activation_ip" binding:"omitempty,ip"` // 激活IP,可选
|
||||
}
|
||||
|
||||
// LicenseRevokeRequest 撤销许可证请求结构
|
||||
@@ -147,9 +147,9 @@ type ActivateRequest struct {
|
||||
|
||||
// ActivateResponse 软件激活响应结构
|
||||
type ActivateResponse struct {
|
||||
LicenseKey string `json:"license_key"` // 许可证密钥
|
||||
LicenseFile string `json:"license_file"` // base64编码的加密许可证文件
|
||||
HeartbeatInterval int `json:"heartbeat_interval"` // 心跳间隔(秒)
|
||||
LicenseKey string `json:"license_key"` // 许可证密钥
|
||||
LicenseFile string `json:"license_file"` // base64编码的加密许可证文件
|
||||
HeartbeatInterval int `json:"heartbeat_interval"` // 心跳间隔(秒)
|
||||
}
|
||||
|
||||
// HeartbeatRequest 心跳检测请求结构
|
||||
@@ -163,23 +163,23 @@ type HeartbeatRequest struct {
|
||||
|
||||
// HeartbeatResponse 心跳检测响应结构
|
||||
type HeartbeatResponse struct {
|
||||
Status string `json:"status"` // 许可证状态
|
||||
ConfigUpdated bool `json:"config_updated"` // 配置是否有更新
|
||||
LicenseFile *string `json:"license_file"` // base64编码的新许可证文件(如有更新)
|
||||
HeartbeatInterval int `json:"heartbeat_interval"` // 下次心跳间隔(秒)
|
||||
Status string `json:"status"` // 许可证状态
|
||||
ConfigUpdated bool `json:"config_updated"` // 配置是否有更新
|
||||
LicenseFile *string `json:"license_file"` // base64编码的新许可证文件(如有更新)
|
||||
HeartbeatInterval int `json:"heartbeat_interval"` // 下次心跳间隔(秒)
|
||||
}
|
||||
|
||||
// StatsOverviewResponse 授权概览统计响应结构
|
||||
type StatsOverviewResponse struct {
|
||||
TotalAuthCodes int64 `json:"total_auth_codes"` // 总授权码数量
|
||||
ActiveLicenses int64 `json:"active_licenses"` // 活跃许可证数量
|
||||
ExpiringSoon int64 `json:"expiring_soon"` // 即将过期数量
|
||||
AbnormalAlerts int64 `json:"abnormal_alerts"` // 异常告警数量
|
||||
GrowthRate GrowthRate `json:"growth_rate"` // 增长率
|
||||
TotalAuthCodes int64 `json:"total_auth_codes"` // 总授权码数量
|
||||
ActiveLicenses int64 `json:"active_licenses"` // 活跃许可证数量
|
||||
ExpiringSoon int64 `json:"expiring_soon"` // 即将过期数量
|
||||
AbnormalAlerts int64 `json:"abnormal_alerts"` // 异常告警数量
|
||||
GrowthRate GrowthRate `json:"growth_rate"` // 增长率
|
||||
}
|
||||
|
||||
// GrowthRate 增长率结构
|
||||
type GrowthRate struct {
|
||||
AuthCodes float64 `json:"auth_codes"` // 授权码增长率(%)
|
||||
Licenses float64 `json:"licenses"` // 许可证增长率(%)
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,21 @@ import (
|
||||
)
|
||||
|
||||
type authorizationCodeService struct {
|
||||
authCodeRepo repository.AuthorizationCodeRepository
|
||||
authCodeRepo repository.AuthorizationCodeRepository
|
||||
customerRepo repository.CustomerRepository
|
||||
licenseRepo repository.LicenseRepository
|
||||
}
|
||||
|
||||
// NewAuthorizationCodeService 创建授权码服务实例
|
||||
func NewAuthorizationCodeService(authCodeRepo repository.AuthorizationCodeRepository) AuthorizationCodeService {
|
||||
func NewAuthorizationCodeService(
|
||||
authCodeRepo repository.AuthorizationCodeRepository,
|
||||
customerRepo repository.CustomerRepository,
|
||||
licenseRepo repository.LicenseRepository,
|
||||
) AuthorizationCodeService {
|
||||
return &authorizationCodeService{
|
||||
authCodeRepo: authCodeRepo,
|
||||
authCodeRepo: authCodeRepo,
|
||||
customerRepo: customerRepo,
|
||||
licenseRepo: licenseRepo,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,6 +186,33 @@ func (s *authorizationCodeService) GetAuthorizationCode(ctx context.Context, id
|
||||
return nil, i18n.NewI18nError("900004", lang, err.Error())
|
||||
}
|
||||
|
||||
// 查询客户信息
|
||||
customer, err := s.customerRepo.GetCustomerByID(ctx, authCode.CustomerID)
|
||||
if err != nil {
|
||||
// 如果客户不存在,不影响授权码查询,只是不填充客户信息
|
||||
// 记录错误日志但不返回错误
|
||||
} else {
|
||||
// 填充客户信息
|
||||
authCode.CustomerInfo = &models.CustomerInfoForAuthCode{
|
||||
ID: customer.ID,
|
||||
CustomerCode: customer.CustomerCode,
|
||||
CustomerName: customer.CustomerName,
|
||||
CustomerType: customer.CustomerType,
|
||||
CustomerTypeDisplay: i18n.GetEnumMessage("customer_type", customer.CustomerType, lang),
|
||||
Status: customer.Status,
|
||||
StatusDisplay: i18n.GetEnumMessage("customer_status", customer.Status, lang),
|
||||
CreatedAt: customer.CreatedAt.Format(time.RFC3339),
|
||||
}
|
||||
}
|
||||
|
||||
// 查询已激活的许可证数量
|
||||
activatedCount, err := s.licenseRepo.GetActiveLicenseCount(ctx, id)
|
||||
if err != nil {
|
||||
// 查询失败时,数量设为0,记录错误日志但不返回错误
|
||||
activatedCount = 0
|
||||
}
|
||||
authCode.ActivatedLicensesCount = activatedCount
|
||||
|
||||
// 填充多语言显示字段和计算状态
|
||||
s.fillAuthorizationCodeDisplayFields(authCode, lang)
|
||||
|
||||
|
||||
Reference in new issue
Block a user