69 lines
1.7 KiB
TypeScript
69 lines
1.7 KiB
TypeScript
// api/modules/video.ts
|
|
/**
|
|
* 视频相关 API
|
|
* 完全保持原项目接口路径和调用方式
|
|
*/
|
|
|
|
import { createRequestClient } from '../request'
|
|
import { SERVICE_MAP } from '../config'
|
|
import type {
|
|
ICheckVideoRequest,
|
|
ICheckVideoResponse,
|
|
ISaveCoursePositionRequest,
|
|
ISaveCoursePositionResponse,
|
|
IAddErrorCourseRequest,
|
|
IAddErrorCourseResponse
|
|
} from '@/types/video'
|
|
|
|
const client = createRequestClient({ baseURL: SERVICE_MAP.MAIN })
|
|
|
|
/**
|
|
* 视频相关 API
|
|
*/
|
|
export const videoApi = {
|
|
/**
|
|
* 检查视频并获取播放凭证
|
|
* 原接口: sociology/course/checkVideo
|
|
*
|
|
* @param data 视频信息(id, video, courseId, catalogueId, chapterId 等)
|
|
* @returns 视频详细信息,包含 playAuth, videoId, m3u8Url, videoUrl 等
|
|
*/
|
|
checkVideo(data: ICheckVideoRequest) {
|
|
return client.request<ICheckVideoResponse>({
|
|
url: 'sociology/course/checkVideo',
|
|
method: 'POST',
|
|
data
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 保存课程播放位置
|
|
* 原接口: sociology/course/saveCoursePosition
|
|
*
|
|
* @param data 包含 videoId 和 position(秒数)
|
|
* @returns 保存结果
|
|
*/
|
|
saveCoursePosition(data: ISaveCoursePositionRequest) {
|
|
return client.request<ISaveCoursePositionResponse>({
|
|
url: 'sociology/course/saveCoursePosition',
|
|
method: 'POST',
|
|
data
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 记录 iOS 不支持的视频
|
|
* 原接口: medical/course/addErrorCourse
|
|
*
|
|
* @param data 包含 chapterId, videoId, sort
|
|
* @returns 记录结果
|
|
*/
|
|
addErrorCourse(data: IAddErrorCourseRequest) {
|
|
return client.request<IAddErrorCourseResponse>({
|
|
url: 'medical/course/addErrorCourse',
|
|
method: 'POST',
|
|
data
|
|
})
|
|
}
|
|
}
|