|
@@ -18,6 +18,7 @@ import { getVideoContentListApi, getUploadVideoContentListApi } from '@src/http/
|
|
|
import { useVideoCategoryOptions } from '@src/views/publishContent/weGZH/hooks/useVideoCategoryOptions';
|
|
import { useVideoCategoryOptions } from '@src/views/publishContent/weGZH/hooks/useVideoCategoryOptions';
|
|
|
import { WeComPlanType, WeVideoItem, VideoSearchPlanType } from '@src/views/publishContent/weCom/type'
|
|
import { WeComPlanType, WeVideoItem, VideoSearchPlanType } from '@src/views/publishContent/weCom/type'
|
|
|
import { enumToOptions } from '@src/utils/helper';
|
|
import { enumToOptions } from '@src/utils/helper';
|
|
|
|
|
+import useLogger from '@src/hooks/useLogger';
|
|
|
|
|
|
|
|
export enum VideoLibraryType {
|
|
export enum VideoLibraryType {
|
|
|
平台视频库 = 0,
|
|
平台视频库 = 0,
|
|
@@ -56,12 +57,25 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, o
|
|
|
const [playingVideo, setPlayingVideo] = useState<WeVideoItem | null>(null);
|
|
const [playingVideo, setPlayingVideo] = useState<WeVideoItem | null>(null);
|
|
|
const [videoLibraryType, setVideoLibraryType] = useState<VideoLibraryType>(VideoLibraryType.平台视频库);
|
|
const [videoLibraryType, setVideoLibraryType] = useState<VideoLibraryType>(VideoLibraryType.平台视频库);
|
|
|
const MAX_SELECTION = 3;
|
|
const MAX_SELECTION = 3;
|
|
|
|
|
+ const { uploadLogVideoPlay, uploadLogVideoPlayEnd, uploadLogVideoCollect, uploadLogVideoListQuery, uploadLogVideoView } = useLogger();
|
|
|
|
|
|
|
|
const getVideoList = async (pageNum?: number, _pageSize?: number) => {
|
|
const getVideoList = async (pageNum?: number, _pageSize?: number) => {
|
|
|
setLoading(true);
|
|
setLoading(true);
|
|
|
setCurrentPage(pageNum || currentPage);
|
|
setCurrentPage(pageNum || currentPage);
|
|
|
setPageSize(_pageSize || pageSize);
|
|
setPageSize(_pageSize || pageSize);
|
|
|
|
|
|
|
|
|
|
+ // 上报视频列表查询日志
|
|
|
|
|
+ uploadLogVideoListQuery({
|
|
|
|
|
+ traceId: Date.now(),
|
|
|
|
|
+ requestId: Date.now(),
|
|
|
|
|
+ planType: planType === WeComPlanType.社群 ? VideoSearchPlanType.企微社群 : VideoSearchPlanType.企微自动回复,
|
|
|
|
|
+ subChannel: 'weCom',
|
|
|
|
|
+ category,
|
|
|
|
|
+ title: searchTerm,
|
|
|
|
|
+ sortType: sort,
|
|
|
|
|
+ videoLibraryType,
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
// 根据视频库类型选择不同的API
|
|
// 根据视频库类型选择不同的API
|
|
|
const apiUrl = videoLibraryType === VideoLibraryType.平台视频库 ? getVideoContentListApi : getUploadVideoContentListApi;
|
|
const apiUrl = videoLibraryType === VideoLibraryType.平台视频库 ? getVideoContentListApi : getUploadVideoContentListApi;
|
|
|
|
|
|
|
@@ -114,12 +128,30 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, o
|
|
|
const newSet = new Set(prev);
|
|
const newSet = new Set(prev);
|
|
|
if (newSet.has(videoId)) {
|
|
if (newSet.has(videoId)) {
|
|
|
newSet.delete(videoId);
|
|
newSet.delete(videoId);
|
|
|
|
|
+ // 上报取消收藏日志
|
|
|
|
|
+ uploadLogVideoCollect({
|
|
|
|
|
+ videoId,
|
|
|
|
|
+ traceId: Date.now(),
|
|
|
|
|
+ requestId: Date.now(),
|
|
|
|
|
+ collect: 0,
|
|
|
|
|
+ planType: planType === WeComPlanType.社群 ? VideoSearchPlanType.企微社群 : VideoSearchPlanType.企微自动回复,
|
|
|
|
|
+ subChannel: 'weCom',
|
|
|
|
|
+ });
|
|
|
} else {
|
|
} else {
|
|
|
if (newSet.size >= MAX_SELECTION) {
|
|
if (newSet.size >= MAX_SELECTION) {
|
|
|
message.warning(`最多只能选择 ${MAX_SELECTION} 条视频`);
|
|
message.warning(`最多只能选择 ${MAX_SELECTION} 条视频`);
|
|
|
return prev;
|
|
return prev;
|
|
|
}
|
|
}
|
|
|
newSet.add(videoId);
|
|
newSet.add(videoId);
|
|
|
|
|
+ // 上报收藏日志
|
|
|
|
|
+ uploadLogVideoCollect({
|
|
|
|
|
+ videoId,
|
|
|
|
|
+ traceId: Date.now(),
|
|
|
|
|
+ requestId: Date.now(),
|
|
|
|
|
+ collect: 1,
|
|
|
|
|
+ planType: planType === WeComPlanType.社群 ? VideoSearchPlanType.企微社群 : VideoSearchPlanType.企微自动回复,
|
|
|
|
|
+ subChannel: 'weCom',
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
return newSet;
|
|
return newSet;
|
|
|
});
|
|
});
|
|
@@ -135,10 +167,29 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, o
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const playVideo = (video: WeVideoItem) => {
|
|
const playVideo = (video: WeVideoItem) => {
|
|
|
|
|
+ // 上报视频播放日志
|
|
|
|
|
+ uploadLogVideoPlay({
|
|
|
|
|
+ videoId: video.videoId,
|
|
|
|
|
+ traceId: Date.now(),
|
|
|
|
|
+ requestId: Date.now(),
|
|
|
|
|
+ planType: planType === WeComPlanType.社群 ? VideoSearchPlanType.企微社群 : VideoSearchPlanType.企微自动回复,
|
|
|
|
|
+ subChannel: 'weCom',
|
|
|
|
|
+ });
|
|
|
setPlayingVideo(video);
|
|
setPlayingVideo(video);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const closeVideoPlayer = () => {
|
|
const closeVideoPlayer = () => {
|
|
|
|
|
+ if (playingVideo) {
|
|
|
|
|
+ // 上报视频播放结束日志
|
|
|
|
|
+ uploadLogVideoPlayEnd({
|
|
|
|
|
+ videoId: playingVideo.videoId,
|
|
|
|
|
+ playTime: 0, // 实际播放时间可以从视频元素中获取,这里暂时设为0
|
|
|
|
|
+ traceId: Date.now(),
|
|
|
|
|
+ requestId: Date.now(),
|
|
|
|
|
+ planType: planType === WeComPlanType.社群 ? VideoSearchPlanType.企微社群 : VideoSearchPlanType.企微自动回复,
|
|
|
|
|
+ subChannel: 'weCom',
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
setPlayingVideo(null);
|
|
setPlayingVideo(null);
|
|
|
};
|
|
};
|
|
|
|
|
|