# 媒体文件管理 GraphQL Schema
|
|
extend type Mutation {
|
"保存媒体文件信息"
|
saveMedia(input: MediaInput!): Media
|
|
"删除媒体文件"
|
deleteMedia(id: ID!): Boolean
|
|
"保存媒体文件(新版本)"
|
saveMediaV2(input: MediaSaveInput!): MediaSaveResponse!
|
|
"保存选手头像"
|
savePlayerAvatar(playerId: ID!, url: String!, fileName: String, fileSize: Long): MediaSaveResponse!
|
|
"保存活动报名附件"
|
saveActivityPlayerAttachment(activityPlayerId: ID!, url: String!, fileName: String, fileSize: Long, mediaType: Int!): MediaSaveResponse!
|
}
|
|
extend type Query {
|
"根据ID获取媒体信息"
|
media(id: ID!): Media
|
|
"根据目标类型和目标ID获取媒体列表"
|
mediasByTarget(targetType: Int!, targetId: ID!): [MediaResponse!]!
|
|
"应用配置(提供媒体前缀等)"
|
appConfig: AppConfig!
|
}
|
|
"媒体输入类型"
|
input MediaInput {
|
name: String!
|
path: String!
|
fileSize: Int!
|
fileExt: String!
|
mediaType: Int!
|
targetType: Int
|
targetId: ID
|
thumbPath: String
|
duration: Int
|
description: String
|
}
|
|
"媒体文件类型"
|
type Media {
|
id: ID!
|
name: String!
|
path: String!
|
fileSize: Int
|
fileExt: String!
|
thumbPath: String
|
duration: Int
|
description: String
|
state: String
|
targetType: Int
|
targetId: ID
|
mediaType: Int!
|
|
"完整访问地址(前缀 + path)"
|
fullUrl: String
|
"缩略图完整地址(前缀 + thumbPath)"
|
fullThumbUrl: String
|
}
|
|
"媒体响应类型"
|
type MediaResponse {
|
id: ID!
|
name: String!
|
path: String!
|
fileSize: Int
|
fileExt: String!
|
thumbPath: String
|
duration: Int
|
description: String
|
targetType: Int
|
targetId: ID
|
mediaType: Int!
|
|
"完整访问地址(前缀 + path)"
|
fullUrl: String
|
"缩略图完整地址(前缀 + thumbPath)"
|
fullThumbUrl: String
|
}
|
|
|
|
"应用配置"
|
type AppConfig {
|
mediaBaseUrl: String!
|
}
|
|
"媒体保存输入类型(新版本)"
|
input MediaSaveInput {
|
targetType: String! # 目标类型:player, activity_player
|
targetId: ID! # 目标ID
|
url: String! # COS文件URL
|
thumbUrl: String # 缩略图URL(可选)
|
fileName: String # 文件名
|
fileExt: String # 文件扩展名
|
fileSize: Long # 文件大小(字节)
|
duration: Int # 视频时长(秒,视频文件专用)
|
mediaType: Int! # 媒体类型:1-图片,2-视频,3-音频,4-文档
|
}
|
|
"媒体保存响应类型"
|
type MediaSaveResponse {
|
success: Boolean!
|
message: String
|
mediaId: ID
|
}
|