From 7afb99751f04d864a2f2546049a51140b27cfeb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Mon, 27 Mar 2023 16:08:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=AD=A6=E4=B9=A0pingAPI?= =?UTF-8?q?=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/course.ts | 5 +++++ src/pages/course/compenents/video.tsx | 1 + 2 files changed, 6 insertions(+) diff --git a/src/api/course.ts b/src/api/course.ts index cbd1701..6753c0e 100644 --- a/src/api/course.ts +++ b/src/api/course.ts @@ -17,6 +17,11 @@ export function record(courseId: number, hourId: number, duration: number) { }); } +//观看ping +export function playPing(courseId: number, hourId: number) { + return client.get(`/api/v1/course/${courseId}/hour/${hourId}/ping`, {}); +} + //最近学习课程 export function latestLearn() { return client.get(`/api/v1/user/latest-learn`, {}); diff --git a/src/pages/course/compenents/video.tsx b/src/pages/course/compenents/video.tsx index 1993e66..1030c92 100644 --- a/src/pages/course/compenents/video.tsx +++ b/src/pages/course/compenents/video.tsx @@ -74,6 +74,7 @@ export const VideoModel: React.FC = ({ if (duration - myRef.current >= 10 || isEnd === true) { setPlayDuration(duration); course.record(cid, id, duration).then((res: any) => {}); + course.playPing(cid, id).then((res: any) => {}); } };