feat: 添加设备和订单汇总接口,支持获取当前用户的设备和订单统计信息,优化授权码管理和设备筛选功能
This commit is contained in:
1 parent
e91775ea76
commit
973b549298
6 files changed
+665
-9
No files matched your search
@@ -25,6 +25,87 @@ const docTemplate = `{
|
|||||||
"host": "{{.Host}}",
|
"host": "{{.Host}}",
|
||||||
"basePath": "{{.BasePath}}",
|
"basePath": "{{.BasePath}}",
|
||||||
"paths": {
|
"paths": {
|
||||||
|
"/api/cu/authorization-codes/product-activation-code": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "获取产品激活码:{授权码}\u0026{payload}(payload 为 RSA-PSS-SHA256 签名封装串)",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"用户端授权码管理"
|
||||||
|
],
|
||||||
|
"summary": "获取产品激活码",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "获取产品激活码请求",
|
||||||
|
"name": "request",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ProductActivationCodeRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "获取成功",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/models.APIResponse"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"data": {
|
||||||
|
"$ref": "#/definitions/models.ProductActivationCodeResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "请求参数无效",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "未认证",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"403": {
|
||||||
|
"description": "授权码已被锁定",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "授权码不存在或已过期",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "服务器内部错误",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/cu/authorization-codes/{codeId}/share": {
|
"/api/cu/authorization-codes/{codeId}/share": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -161,6 +242,12 @@ const docTemplate = `{
|
|||||||
"description": "按授权码ID筛选设备",
|
"description": "按授权码ID筛选设备",
|
||||||
"name": "authorization_code_id",
|
"name": "authorization_code_id",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否在线筛选:true在线,false离线",
|
||||||
|
"name": "is_online",
|
||||||
|
"in": "query"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -203,6 +290,58 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/cu/devices/summary": {
|
||||||
|
"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.DeviceSummaryResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "未认证",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "服务器内部错误",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/cu/devices/{id}": {
|
"/api/cu/devices/{id}": {
|
||||||
"delete": {
|
"delete": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -666,6 +805,58 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/cu/orders/summary": {
|
||||||
|
"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.OrderSummaryResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "未认证",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "服务器内部错误",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/cu/orders/{order_id}": {
|
"/api/cu/orders/{order_id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -5375,6 +5566,23 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"models.DeviceSummaryResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"offline_devices": {
|
||||||
|
"description": "离线设备数",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"online_devices": {
|
||||||
|
"description": "在线设备数",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"total_devices": {
|
||||||
|
"description": "设备总数",
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"models.EnumItem": {
|
"models.EnumItem": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -5833,6 +6041,23 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"models.OrderSummaryResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"paid_orders": {
|
||||||
|
"description": "已支付订单数",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"pending_orders": {
|
||||||
|
"description": "待支付订单数",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"total_orders": {
|
||||||
|
"description": "订单总数",
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"models.PaymentBusinessOrder": {
|
"models.PaymentBusinessOrder": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -5946,6 +6171,27 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"models.ProductActivationCodeRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"authorization_code"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"authorization_code": {
|
||||||
|
"description": "授权码(旧规则格式)",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.ProductActivationCodeResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"product_activation_code": {
|
||||||
|
"description": "产品激活码:{授权码}\u0026{payload}",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"models.RecentAuthorization": {
|
"models.RecentAuthorization": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@@ -21,6 +21,87 @@
|
|||||||
},
|
},
|
||||||
"basePath": "/",
|
"basePath": "/",
|
||||||
"paths": {
|
"paths": {
|
||||||
|
"/api/cu/authorization-codes/product-activation-code": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "获取产品激活码:{授权码}\u0026{payload}(payload 为 RSA-PSS-SHA256 签名封装串)",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"用户端授权码管理"
|
||||||
|
],
|
||||||
|
"summary": "获取产品激活码",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "获取产品激活码请求",
|
||||||
|
"name": "request",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ProductActivationCodeRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "获取成功",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/models.APIResponse"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"data": {
|
||||||
|
"$ref": "#/definitions/models.ProductActivationCodeResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "请求参数无效",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "未认证",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"403": {
|
||||||
|
"description": "授权码已被锁定",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "授权码不存在或已过期",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "服务器内部错误",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/cu/authorization-codes/{codeId}/share": {
|
"/api/cu/authorization-codes/{codeId}/share": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -157,6 +238,12 @@
|
|||||||
"description": "按授权码ID筛选设备",
|
"description": "按授权码ID筛选设备",
|
||||||
"name": "authorization_code_id",
|
"name": "authorization_code_id",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否在线筛选:true在线,false离线",
|
||||||
|
"name": "is_online",
|
||||||
|
"in": "query"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -199,6 +286,58 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/cu/devices/summary": {
|
||||||
|
"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.DeviceSummaryResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "未认证",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "服务器内部错误",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/cu/devices/{id}": {
|
"/api/cu/devices/{id}": {
|
||||||
"delete": {
|
"delete": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -662,6 +801,58 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/cu/orders/summary": {
|
||||||
|
"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.OrderSummaryResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "未认证",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "服务器内部错误",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/cu/orders/{order_id}": {
|
"/api/cu/orders/{order_id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -5371,6 +5562,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"models.DeviceSummaryResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"offline_devices": {
|
||||||
|
"description": "离线设备数",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"online_devices": {
|
||||||
|
"description": "在线设备数",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"total_devices": {
|
||||||
|
"description": "设备总数",
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"models.EnumItem": {
|
"models.EnumItem": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -5829,6 +6037,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"models.OrderSummaryResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"paid_orders": {
|
||||||
|
"description": "已支付订单数",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"pending_orders": {
|
||||||
|
"description": "待支付订单数",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"total_orders": {
|
||||||
|
"description": "订单总数",
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"models.PaymentBusinessOrder": {
|
"models.PaymentBusinessOrder": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -5942,6 +6167,27 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"models.ProductActivationCodeRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"authorization_code"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"authorization_code": {
|
||||||
|
"description": "授权码(旧规则格式)",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.ProductActivationCodeResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"product_activation_code": {
|
||||||
|
"description": "产品激活码:{授权码}\u0026{payload}",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"models.RecentAuthorization": {
|
"models.RecentAuthorization": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@@ -1046,6 +1046,18 @@ definitions:
|
|||||||
description: 总数量
|
description: 总数量
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
models.DeviceSummaryResponse:
|
||||||
|
properties:
|
||||||
|
offline_devices:
|
||||||
|
description: 离线设备数
|
||||||
|
type: integer
|
||||||
|
online_devices:
|
||||||
|
description: 在线设备数
|
||||||
|
type: integer
|
||||||
|
total_devices:
|
||||||
|
description: 设备总数
|
||||||
|
type: integer
|
||||||
|
type: object
|
||||||
models.EnumItem:
|
models.EnumItem:
|
||||||
properties:
|
properties:
|
||||||
display:
|
display:
|
||||||
@@ -1368,6 +1380,18 @@ definitions:
|
|||||||
description: 响应消息
|
description: 响应消息
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
models.OrderSummaryResponse:
|
||||||
|
properties:
|
||||||
|
paid_orders:
|
||||||
|
description: 已支付订单数
|
||||||
|
type: integer
|
||||||
|
pending_orders:
|
||||||
|
description: 待支付订单数
|
||||||
|
type: integer
|
||||||
|
total_orders:
|
||||||
|
description: 订单总数
|
||||||
|
type: integer
|
||||||
|
type: object
|
||||||
models.PaymentBusinessOrder:
|
models.PaymentBusinessOrder:
|
||||||
properties:
|
properties:
|
||||||
authorization_code:
|
authorization_code:
|
||||||
@@ -1442,6 +1466,20 @@ definitions:
|
|||||||
trade_no:
|
trade_no:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
models.ProductActivationCodeRequest:
|
||||||
|
properties:
|
||||||
|
authorization_code:
|
||||||
|
description: 授权码(旧规则格式)
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- authorization_code
|
||||||
|
type: object
|
||||||
|
models.ProductActivationCodeResponse:
|
||||||
|
properties:
|
||||||
|
product_activation_code:
|
||||||
|
description: 产品激活码:{授权码}&{payload}
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
models.RecentAuthorization:
|
models.RecentAuthorization:
|
||||||
properties:
|
properties:
|
||||||
code:
|
code:
|
||||||
@@ -1632,6 +1670,55 @@ paths:
|
|||||||
summary: 用户分享授权码
|
summary: 用户分享授权码
|
||||||
tags:
|
tags:
|
||||||
- 用户端授权码管理
|
- 用户端授权码管理
|
||||||
|
/api/cu/authorization-codes/product-activation-code:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: 获取产品激活码:{授权码}&{payload}(payload 为 RSA-PSS-SHA256 签名封装串)
|
||||||
|
parameters:
|
||||||
|
- description: 获取产品激活码请求
|
||||||
|
in: body
|
||||||
|
name: request
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.ProductActivationCodeRequest'
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 获取成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/models.APIResponse'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
$ref: '#/definitions/models.ProductActivationCodeResponse'
|
||||||
|
type: object
|
||||||
|
"400":
|
||||||
|
description: 请求参数无效
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.ErrorResponse'
|
||||||
|
"401":
|
||||||
|
description: 未认证
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.ErrorResponse'
|
||||||
|
"403":
|
||||||
|
description: 授权码已被锁定
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.ErrorResponse'
|
||||||
|
"404":
|
||||||
|
description: 授权码不存在或已过期
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.ErrorResponse'
|
||||||
|
"500":
|
||||||
|
description: 服务器内部错误
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.ErrorResponse'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: 获取产品激活码
|
||||||
|
tags:
|
||||||
|
- 用户端授权码管理
|
||||||
/api/cu/devices:
|
/api/cu/devices:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
@@ -1654,6 +1741,10 @@ paths:
|
|||||||
in: query
|
in: query
|
||||||
name: authorization_code_id
|
name: authorization_code_id
|
||||||
type: string
|
type: string
|
||||||
|
- description: 是否在线筛选:true在线,false离线
|
||||||
|
in: query
|
||||||
|
name: is_online
|
||||||
|
type: boolean
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
@@ -1726,6 +1817,36 @@ paths:
|
|||||||
summary: 解绑设备
|
summary: 解绑设备
|
||||||
tags:
|
tags:
|
||||||
- 客户设备管理
|
- 客户设备管理
|
||||||
|
/api/cu/devices/summary:
|
||||||
|
get:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: 获取当前登录用户的设备汇总统计信息(总数、在线数、离线数)
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 获取成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/models.APIResponse'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
$ref: '#/definitions/models.DeviceSummaryResponse'
|
||||||
|
type: object
|
||||||
|
"401":
|
||||||
|
description: 未认证
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.ErrorResponse'
|
||||||
|
"500":
|
||||||
|
description: 服务器内部错误
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.ErrorResponse'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: 获取设备汇总统计
|
||||||
|
tags:
|
||||||
|
- 客户设备管理
|
||||||
/api/cu/forgot-password:
|
/api/cu/forgot-password:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
@@ -2010,6 +2131,36 @@ paths:
|
|||||||
summary: 计算订单价格
|
summary: 计算订单价格
|
||||||
tags:
|
tags:
|
||||||
- 客户订单管理
|
- 客户订单管理
|
||||||
|
/api/cu/orders/summary:
|
||||||
|
get:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: 获取当前登录用户的订单汇总统计信息(总数、待支付数、已支付数)
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 获取成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/models.APIResponse'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
$ref: '#/definitions/models.OrderSummaryResponse'
|
||||||
|
type: object
|
||||||
|
"401":
|
||||||
|
description: 未认证
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.ErrorResponse'
|
||||||
|
"500":
|
||||||
|
description: 服务器内部错误
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.ErrorResponse'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: 获取订单汇总统计
|
||||||
|
tags:
|
||||||
|
- 客户订单管理
|
||||||
/api/cu/packages:
|
/api/cu/packages:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ func NewCuDeviceHandler(cuDeviceService service.CuDeviceService) *CuDeviceHandle
|
|||||||
// @Param page_size query int false "每页数量,默认20,最大100"
|
// @Param page_size query int false "每页数量,默认20,最大100"
|
||||||
// @Param device_name query string false "设备名称模糊搜索"
|
// @Param device_name query string false "设备名称模糊搜索"
|
||||||
// @Param authorization_code_id query string false "按授权码ID筛选设备"
|
// @Param authorization_code_id query string false "按授权码ID筛选设备"
|
||||||
|
// @Param is_online query bool false "是否在线筛选:true在线,false离线"
|
||||||
// @Success 200 {object} models.APIResponse{data=models.DeviceListResponse} "获取成功"
|
// @Success 200 {object} models.APIResponse{data=models.DeviceListResponse} "获取成功"
|
||||||
// @Failure 400 {object} models.ErrorResponse "请求参数无效"
|
// @Failure 400 {object} models.ErrorResponse "请求参数无效"
|
||||||
// @Failure 401 {object} models.ErrorResponse "未认证"
|
// @Failure 401 {object} models.ErrorResponse "未认证"
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ type DeviceListRequest struct {
|
|||||||
PageSize int `form:"page_size" binding:"omitempty,min=1,max=100"` // 每页数量,默认20,最大100
|
PageSize int `form:"page_size" binding:"omitempty,min=1,max=100"` // 每页数量,默认20,最大100
|
||||||
DeviceName string `form:"device_name" binding:"omitempty,max=100"` // 设备名称模糊搜索(匹配device_info.name)
|
DeviceName string `form:"device_name" binding:"omitempty,max=100"` // 设备名称模糊搜索(匹配device_info.name)
|
||||||
AuthorizationCodeID string `form:"authorization_code_id" binding:"omitempty,len=36"` // 按授权码ID筛选设备
|
AuthorizationCodeID string `form:"authorization_code_id" binding:"omitempty,len=36"` // 按授权码ID筛选设备
|
||||||
|
IsOnline *bool `form:"is_online" binding:"omitempty"` // 是否在线筛选(true在线,false离线;不传不过滤)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeviceListItem 设备列表项结构(客户用户接口)
|
// DeviceListItem 设备列表项结构(客户用户接口)
|
||||||
|
|||||||
@@ -278,6 +278,16 @@ func (r *licenseRepository) GetCustomerDeviceList(ctx context.Context, customerI
|
|||||||
Where("licenses.customer_id = ? AND licenses.status = ? AND licenses.deleted_at IS NULL",
|
Where("licenses.customer_id = ? AND licenses.status = ? AND licenses.deleted_at IS NULL",
|
||||||
customerID, "active")
|
customerID, "active")
|
||||||
|
|
||||||
|
// 获取心跳超时配置(秒)
|
||||||
|
cfg := config.GetConfig()
|
||||||
|
heartbeatTimeoutSeconds := cfg.License.HeartbeatTimeout
|
||||||
|
if heartbeatTimeoutSeconds <= 0 {
|
||||||
|
heartbeatTimeoutSeconds = 300 // 默认5分钟
|
||||||
|
}
|
||||||
|
|
||||||
|
now := time.Now()
|
||||||
|
onlineThreshold := now.Add(-time.Duration(heartbeatTimeoutSeconds) * time.Second)
|
||||||
|
|
||||||
// 按授权码ID筛选
|
// 按授权码ID筛选
|
||||||
if req.AuthorizationCodeID != "" {
|
if req.AuthorizationCodeID != "" {
|
||||||
query = query.Where("licenses.authorization_code_id = ?", req.AuthorizationCodeID)
|
query = query.Where("licenses.authorization_code_id = ?", req.AuthorizationCodeID)
|
||||||
@@ -288,6 +298,15 @@ func (r *licenseRepository) GetCustomerDeviceList(ctx context.Context, customerI
|
|||||||
query = query.Where("JSON_EXTRACT(licenses.device_info, '$.name') LIKE ?", "%"+req.DeviceName+"%")
|
query = query.Where("JSON_EXTRACT(licenses.device_info, '$.name') LIKE ?", "%"+req.DeviceName+"%")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 在线状态筛选
|
||||||
|
if req.IsOnline != nil {
|
||||||
|
if *req.IsOnline {
|
||||||
|
query = query.Where("licenses.last_heartbeat > ?", onlineThreshold)
|
||||||
|
} else {
|
||||||
|
query = query.Where("(licenses.last_heartbeat <= ? OR licenses.last_heartbeat IS NULL)", onlineThreshold)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 获取总数
|
// 获取总数
|
||||||
var total int64
|
var total int64
|
||||||
if err := query.Count(&total).Error; err != nil {
|
if err := query.Count(&total).Error; err != nil {
|
||||||
@@ -317,14 +336,6 @@ func (r *licenseRepository) GetCustomerDeviceList(ctx context.Context, customerI
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取心跳超时配置(秒)
|
|
||||||
cfg := config.GetConfig()
|
|
||||||
heartbeatTimeoutSeconds := cfg.License.HeartbeatTimeout
|
|
||||||
if heartbeatTimeoutSeconds <= 0 {
|
|
||||||
heartbeatTimeoutSeconds = 300 // 默认5分钟
|
|
||||||
}
|
|
||||||
|
|
||||||
now := time.Now()
|
|
||||||
devices := make([]models.DeviceListItem, len(scanResults))
|
devices := make([]models.DeviceListItem, len(scanResults))
|
||||||
|
|
||||||
for i, result := range scanResults {
|
for i, result := range scanResults {
|
||||||
@@ -337,7 +348,7 @@ func (r *licenseRepository) GetCustomerDeviceList(ctx context.Context, customerI
|
|||||||
|
|
||||||
// 计算在线状态(使用心跳超时配置)
|
// 计算在线状态(使用心跳超时配置)
|
||||||
isOnline := false
|
isOnline := false
|
||||||
if result.LastHeartbeat != nil && result.LastHeartbeat.After(now.Add(-time.Duration(heartbeatTimeoutSeconds)*time.Second)) {
|
if result.LastHeartbeat != nil && result.LastHeartbeat.After(onlineThreshold) {
|
||||||
isOnline = true
|
isOnline = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user