Ver código fonte

change log data

jihuaqiang 2 anos atrás
pai
commit
51bbee04ce

+ 21 - 7
components/MobileLandPage.vue

@@ -69,7 +69,7 @@
 </template>
 <script>
 import { RewardType, PlayType } from '../types';
-import { getStorage, setStorage, removeStorage, storageKey, getMid, getOauthUrl, appType } from '../utils/help';
+import { getStorage, setStorage, removeStorage, storageKey, getMid, getOauthUrl } from '../utils/help';
 import { postRequest } from '../http';
 import FontZoom from './FontZoom';
 import { Toast } from 'vant';
@@ -123,11 +123,21 @@ export default {
 			type: String,
 			default: '',
 		},
+		srcContentId: {
+			// 推文ID
+			type: String,
+			default: '',
+		},
 		postId: {
 			// 推文ID,用于retweer
 			type: String,
 			default: '',
 		},
+		nftProjectId: {
+			// NFT ID
+			type: String,
+			default: '',
+		},
 		prizePicPath: {
 			// NFT图片
 			type: String,
@@ -192,29 +202,33 @@ export default {
 	methods: {
 		toLogin() {
 			let userInfo = getStorage(storageKey.userInfo);
-			Report.reportLog({
+			let logData = {
 				baseInfo: {
 					mid: getMid(),
 					pageSource: Report.pageSource.mobileLandingPage,
-					appType,
 					machineCode: getMid(),
 				},
 				params: {
 					eventData: {
 						businessType: Report.businessType.buttonClick,
-						objectType: userInfo ? Report.businessType.cliamRewardButton : Report.businessType.loginTwitterButton,
+						objectType: userInfo ? Report.objectType.cliamRewardButton : Report.objectType.loginTwitterButton,
 						postId: this.postId,
 					},
 				},
-			});
+			};
+			if (this.isNFTCpd) {
+				delete logData.params.eventData.postId;
+				logData.params.eventData.nftProjectId = this.nftProjectId;
+			}
+			Report.reportLog(logData);
 			if (userInfo) {
-				location.href = `/course?useful=${this.useFul ? '1' : '0'}&playType=${this.playType}&rewardType=${this.rewardType}&postId=${this.postId}`;
+				location.href = `/course?useful=${this.useFul ? '1' : '0'}&playType=${this.playType}&rewardType=${this.rewardType}&postId=${this.postId}&nftProjectId=${this.nftProjectId}&srcContentId=${this.srcContentId}`;
 			} else {
 				this.twitterAuth();
 			}
 		},
 		cancelLogin() {
-			location.href = `/course?useful=${this.useFul ? '1' : '0'}&playType=${this.playType}&rewardType=${this.rewardType}&postId=${this.postId}`;
+			location.href = `/course?useful=${this.useFul ? '1' : '0'}&playType=${this.playType}&rewardType=${this.rewardType}&postId=${this.postId}&nftProjectId=${this.nftProjectId}&srcContentId=${this.srcContentId}`;
 		},
 		async twitterAuth() {
 			let win = window.open();

+ 1 - 0
log-center/logger.js

@@ -28,6 +28,7 @@ function paramsPretreatmentAndRequest(logType, params) {
 	}
 	params.baseInfo.appVersionCode = appVersionCode;
 	let isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
+	params.baseInfo.appType = isMobile ? 2 : 1;
 	let platform = isMobile ? `mobile` : `pc`;
 	let browser = getBrowser();
 	let extData = {

+ 16 - 12
pages/course/index.vue

@@ -25,7 +25,7 @@
 import { PlayType, UsefulType } from '../../types';
 import axios from 'axios';
 import Report from '../../log-center/log';
-import { getQueryString, baseURL, appVersionCode, getMid, appType } from '../../utils/help';
+import { getQueryString, baseURL, appVersionCode, getMid } from '../../utils/help';
 
 export default {
 	name: 'course',
@@ -49,6 +49,9 @@ export default {
 		isTreasureCpd() {
 			return +this.playType === PlayType.Treasure;
 		},
+		isNFTCpd() {
+			return +this.playType === PlayType.NFT;
+		},
 		isUsefulCpd() {
 			return this.useful === '1';
 		},
@@ -74,11 +77,10 @@ export default {
 			this.reportLog();
 		},
 		retweer() {
-			Report.reportLog({
+			let logData = {
 				baseInfo: {
 					mid: getMid(),
 					pageSource: Report.pageSource.tutorialPage,
-					appType,
 					machineCode: getMid(),
 				},
 				params: {
@@ -87,21 +89,18 @@ export default {
 						objectType: Report.objectType.rtButton,
 						postId: getQueryString('postId'),
 					},
-					extParams: {
-						pageindex: this.active + 1,
-					},
 				},
-			});
-			if (getQueryString('postId')) {
-				window.open(`https://twitter.com/intent/retweet?tweet_id=${getQueryString('postId')}`);
+			};
+			Report.reportLog(logData);
+			if (getQueryString('srcContentId')) {
+				window.open(`https://twitter.com/intent/retweet?tweet_id=${getQueryString('srcContentId')}`);
 			}
 		},
 		reportLog() {
-			Report.reportLog({
+			let logData = {
 				baseInfo: {
 					mid: getMid(),
 					pageSource: Report.pageSource.tutorialPage,
-					appType,
 					machineCode: getMid(),
 				},
 				params: {
@@ -113,7 +112,12 @@ export default {
 						pageindex: this.active + 1,
 					},
 				},
-			});
+			};
+			if (this.isNFTCpd) {
+				delete logData.params.eventData.postId;
+				logData.params.eventData.nftProjectId = getQueryString('nftProjectId');
+			}
+			Report.reportLog(logData);
 		},
 	},
 	async asyncData(params) {

+ 2 - 6
pages/index.vue

@@ -212,7 +212,8 @@
 			:amountValue="isMoneyPrize ? this.detail.postBizData.amountValue : ''"
 			:usValue="isMoneyPrize ? this.detail.postBizData.usdAmountValue : ''"
 			:prize="isMoneyPrize ? this.detail.postBizData.currencySymbol : this.detail.postBizData.customizedReward"
-			:postId="this.detail.srcContentId"
+			:postId="this.detail.postId"
+			:srcContentId="this.detail.srcContentId"
 		>
 		</MobileLandPage>
 	</div>
@@ -672,17 +673,12 @@ export default {
 						appVersionCode: this.appVersionCode,
 						mid: this.mid,
 						pageSource: Report.pageSource.mobileLandingPage,
-						appType,
 						machineCode: this.mid,
 					},
 					params: {
 						eventData: {
 							businessType: Report.businessType.pageView,
 							postId: this.detail.postId,
-							srcContentId: this.detail.srcContentId,
-							senderId: this.detail.srcUserId,
-							redPacketType: 0,
-							customCover: this.customCover,
 						},
 					},
 				});

+ 2 - 7
pages/luckdraw.vue

@@ -16,7 +16,8 @@
 				:amountValue="isMoneyPrize ? this.detail.postBizData.amountValue : ''"
 				:usValue="isMoneyPrize ? this.detail.postBizData.usdAmountValue : ''"
 				:prize="isMoneyPrize ? this.detail.postBizData.currencySymbol : this.detail.postBizData.customizedReward"
-				:postId="this.detail.srcContentId"
+				:srcContentId="this.detail.srcContentId"
+				:postId="this.detail.postId"
 			>
 			</MobileLandPage>
 			<!-- PC端 -->
@@ -627,18 +628,12 @@ export default {
 						appVersionCode: appVersionCode,
 						mid: this.mid,
 						pageSource: Report.pageSource.mobileLandingPage,
-						appType,
 						machineCode: this.mid,
 					},
 					params: {
 						eventData: {
 							businessType: Report.businessType.pageView,
 							postId: this.detail.postId,
-							srcContentId: this.detail.srcContentId,
-							senderId: this.detail.srcUserId,
-							redPacketType: 1,
-							customCover: this.customCover,
-							customGiveaway: this.customGiveaway,
 						},
 					},
 				});

+ 5 - 12
pages/nft/index.vue

@@ -4,7 +4,7 @@
 			<img class="loading" src="../../static/svg/icon-loading.svg" />
 		</template>
 		<template v-else>
-			<MobileLandPage v-if="isMobile" :prizePicPath="detail.pageImagePath" :playType="PlayType.NFT" :prize="detail.nftProjectName" :useFul="detail.purchaseStatus === 1" :postId="detail.srcContentId"> </MobileLandPage>
+			<MobileLandPage v-if="isMobile" :prizePicPath="detail.pageImagePath" :playType="PlayType.NFT" :prize="detail.nftProjectName" :useFul="detail.purchaseStatus === 1" :nftProjectId="detail.nftProjectId"> </MobileLandPage>
 			<template v-else>
 				<div class="logo">
 					<img src="/img/icon-logo.png" alt />
@@ -35,7 +35,7 @@
 import axios from 'axios';
 import Cookies from 'js-cookie';
 import { Toast } from 'vant';
-import { isBrowser, appVersionCode, appType } from '../../utils/help.js';
+import { isBrowser, appVersionCode } from '../../utils/help.js';
 import Report from '@/log-center/log';
 import { PlayType } from './../../types';
 
@@ -127,6 +127,7 @@ export default {
 			},
 		});
 		if (data.code == 0 && data.data !== null) {
+			console.log(data.data);
 			return {
 				detail: data.data,
 			};
@@ -159,16 +160,12 @@ export default {
 				appVersionCode: appVersionCode,
 				mid: this.mid,
 				pageSource: this.pageSource,
-				appType,
 				machineCode: this.mid,
 			},
 			params: {
 				eventData: {
 					businessType: Report.businessType.pageView,
-					postId: this.detail.postId,
-					srcContentId: this.detail.srcContentId,
-					senderId: this.detail.srcUserId,
-					redPacketType: 2,
+					nftProjectId: this.detail.nftProjectId,
 				},
 			},
 		});
@@ -180,17 +177,13 @@ export default {
 					appVersionCode: appVersionCode,
 					mid: this.mid,
 					pageSource: this.pageSource,
-					appType,
 					machineCode: this.mid,
 				},
 				params: {
 					eventData: {
 						businessType: Report.businessType.buttonClick,
 						objectType: Report.objectType.installButton,
-						postId: this.detail.postId,
-						srcContentId: this.detail.srcContentId,
-						senderId: this.detail.srcUserId,
-						redPacketType: 2,
+						nftProjectId: this.detail.nftProjectId,
 					},
 				},
 			});

+ 1 - 1
utils/help.js

@@ -134,7 +134,7 @@ export function formatSecondsAsDaysOrTime(secs) {
 
 export const appVersionCode = 17;
 
-export const appType = 2;
+export const appType = 1;
 
 export function getBrowserType() {
 	let device = ''; // ios 安卓 chrome no-chrome