feat: 添加媒体播放功能,支持基于短时效token的播放入口及相关API接口

This commit is contained in:
2025-12-22 17:44:25 +08:00
parent 70bba28492
commit 335a546aab
18 changed files with 639 additions and 38 deletions

View File

@@ -2340,6 +2340,37 @@ const docTemplate = `{
}
}
},
"/t/{tenantCode}/v1/media/play": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"TenantMedia"
],
"summary": "媒体播放入口(短时效 token",
"parameters": [
{
"type": "string",
"description": "Tenant Code",
"name": "tenantCode",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Play token",
"name": "token",
"in": "query",
"required": true
}
],
"responses": {}
}
},
"/t/{tenantCode}/v1/orders": {
"get": {
"consumes": [
@@ -3235,10 +3266,10 @@ const docTemplate = `{
"type": "object",
"properties": {
"assets": {
"description": "Assets is the list of media assets for the requested role (preview/main).",
"description": "Assets is the list of playable assets for the requested role (preview/main).",
"type": "array",
"items": {
"$ref": "#/definitions/models.MediaAsset"
"$ref": "#/definitions/dto.ContentPlayableAsset"
}
},
"content": {
@@ -3330,6 +3361,32 @@ const docTemplate = `{
}
}
},
"dto.ContentPlayableAsset": {
"type": "object",
"properties": {
"asset_id": {
"type": "integer"
},
"expires_at": {
"description": "ExpiresAt indicates when PlayURL/token expires; optional.",
"type": "string"
},
"meta": {
"description": "Meta is a display-safe whitelist (currently passthrough JSON); optional.",
"type": "array",
"items": {
"type": "integer"
}
},
"play_url": {
"description": "PlayURL is a short-lived URL; do NOT expose bucket/object_key directly.",
"type": "string"
},
"type": {
"$ref": "#/definitions/consts.MediaAssetType"
}
}
},
"dto.ContentPriceUpsertForm": {
"type": "object",
"properties": {

View File

@@ -2334,6 +2334,37 @@
}
}
},
"/t/{tenantCode}/v1/media/play": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"TenantMedia"
],
"summary": "媒体播放入口(短时效 token",
"parameters": [
{
"type": "string",
"description": "Tenant Code",
"name": "tenantCode",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Play token",
"name": "token",
"in": "query",
"required": true
}
],
"responses": {}
}
},
"/t/{tenantCode}/v1/orders": {
"get": {
"consumes": [
@@ -3229,10 +3260,10 @@
"type": "object",
"properties": {
"assets": {
"description": "Assets is the list of media assets for the requested role (preview/main).",
"description": "Assets is the list of playable assets for the requested role (preview/main).",
"type": "array",
"items": {
"$ref": "#/definitions/models.MediaAsset"
"$ref": "#/definitions/dto.ContentPlayableAsset"
}
},
"content": {
@@ -3324,6 +3355,32 @@
}
}
},
"dto.ContentPlayableAsset": {
"type": "object",
"properties": {
"asset_id": {
"type": "integer"
},
"expires_at": {
"description": "ExpiresAt indicates when PlayURL/token expires; optional.",
"type": "string"
},
"meta": {
"description": "Meta is a display-safe whitelist (currently passthrough JSON); optional.",
"type": "array",
"items": {
"type": "integer"
}
},
"play_url": {
"description": "PlayURL is a short-lived URL; do NOT expose bucket/object_key directly.",
"type": "string"
},
"type": {
"$ref": "#/definitions/consts.MediaAssetType"
}
}
},
"dto.ContentPriceUpsertForm": {
"type": "object",
"properties": {

View File

@@ -449,9 +449,10 @@ definitions:
dto.ContentAssetsResponse:
properties:
assets:
description: Assets is the list of media assets for the requested role (preview/main).
description: Assets is the list of playable assets for the requested role
(preview/main).
items:
$ref: '#/definitions/models.MediaAsset'
$ref: '#/definitions/dto.ContentPlayableAsset'
type: array
content:
allOf:
@@ -512,6 +513,26 @@ definitions:
description: Price is the current price settings for the content (may be nil
if not set).
type: object
dto.ContentPlayableAsset:
properties:
asset_id:
type: integer
expires_at:
description: ExpiresAt indicates when PlayURL/token expires; optional.
type: string
meta:
description: Meta is a display-safe whitelist (currently passthrough JSON);
optional.
items:
type: integer
type: array
play_url:
description: PlayURL is a short-lived URL; do NOT expose bucket/object_key
directly.
type: string
type:
$ref: '#/definitions/consts.MediaAssetType'
type: object
dto.ContentPriceUpsertForm:
properties:
currency:
@@ -2855,6 +2876,27 @@ paths:
summary: 当前租户余额流水(分页)
tags:
- Tenant
/t/{tenantCode}/v1/media/play:
get:
consumes:
- application/json
parameters:
- description: Tenant Code
in: path
name: tenantCode
required: true
type: string
- description: Play token
in: query
name: token
required: true
type: string
produces:
- application/json
responses: {}
summary: 媒体播放入口(短时效 token
tags:
- TenantMedia
/t/{tenantCode}/v1/orders:
get:
consumes: