Bladeren bron

feat: 视频曝光增加字段

jihuaqiang 1 week geleden
bovenliggende
commit
e378cbadcd
2 gewijzigde bestanden met toevoegingen van 18 en 2 verwijderingen
  1. 11 1
      src/hooks/useLogger.ts
  2. 7 1
      src/views/publishContent/weCom/components/videoSelectModal/index.tsx

+ 11 - 1
src/hooks/useLogger.ts

@@ -24,6 +24,11 @@ type VideoListQueryLogParams = {
 
 type VideoLogParams = {
 	videoId: number;
+	score?: number;
+	tags?: TagType[];
+	title?: string;
+	cover?: string;
+	libraryType?: VideoLibraryType;
 	playTime?: number;
 	idx?: number;
 	collect?: number;
@@ -122,13 +127,18 @@ const useLogger = () => {
 		});
 	}
 
-	const uploadLogVideoView = ({videoId, idx, traceId, requestId, planType, gzhAccountId, subChannel}: VideoLogParams) => { 
+	const uploadLogVideoView = ({videoId, idx, score, tags, title, cover, libraryType, traceId, requestId, planType, gzhAccountId, subChannel}: VideoLogParams) => { 
 		return uploadLog({
 			businessType: 'video_view',
 			objectType: 'video',
 			extParams: {
 				videoId,
 				idx,
+				score,
+				tags,
+				title,
+				cover,
+				libraryType,
 				traceId,
 				requestId,
 				planType,

+ 7 - 1
src/views/publishContent/weCom/components/videoSelectModal/index.tsx

@@ -210,7 +210,7 @@ export const VideoSelectContent: React.FC<VideoSelectContentProps> = ({
 			});
 		});
 		if (res && res.code === 0) {
-			const newVideoList = (res.data.objs || []).map(v => ({...v, requestId: _requestId}));
+			const newVideoList = (res.data.objs || []).map(v => ({...v, requestId: _requestId, videoLibraryType: currentVideoLibraryType as VideoLibraryType }));
 			setVideoList([...selectedVideos, ...newVideoList.filter(v => !selectedVideos.find(ov => ov.videoId === v.videoId))]);
 			setVideoListAll(old => [...old, ...newVideoList.filter(v => !old.find(ov => ov.videoId === v.videoId))]);
 			setTotal(res.data.totalSize);
@@ -362,8 +362,14 @@ export const VideoSelectContent: React.FC<VideoSelectContentProps> = ({
 								// 使用 ref 中的最新值
 								const params = logParamsRef.current;
 								const idx = parseInt(entry.target.getAttribute('data-idx') || '0');
+								const currentVideo = videoList.find(v => v.videoId === videoId);
 								params.uploadLogVideoView({
 									videoId: videoId,
+									score: currentVideo?.recommendScore,
+									tags: currentVideo?.tags,
+									title: currentVideo?.title,
+									cover: currentVideo?.cover,
+									libraryType: currentVideo?.videoLibraryType,
 									idx: idx,
 									traceId: params.traceId,
 									requestId: params.requestId,