|
@@ -4,6 +4,7 @@ import useHotLaunch from '@/hooks/useHotLaunch'
|
|
|
import { RECOMMEND_PAGESOURCE, USER_SHARE_PAGESOURCE, CATEGORY_PAGESOURCE, DETAIL_PAGESOURCE, DETAIL_RECOMMEND } from '@/const'
|
|
|
import { shareReport, weixinFriend, shareClickReport } from '@/logger'
|
|
|
import { USER_SENCE } from '@/const/index'
|
|
|
+import { APP_ID, APP_TYPE, APP_VERSION_CODE, VERSION_CODE } from '@/config'
|
|
|
|
|
|
export function sharePageAppMessage({ video, activeIndex, router, shareRes }) {
|
|
|
useHotLaunch.valid = false
|
|
@@ -31,7 +32,6 @@ export function sharePageAppMessage({ video, activeIndex, router, shareRes }) {
|
|
|
scene: launchOption.scene,
|
|
|
shareButtonType: dataset?.buttonType || 0,
|
|
|
prePageSource: '',
|
|
|
- userSence: params.userSence
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -41,15 +41,12 @@ export function shareVideoToWechat(params) {
|
|
|
const shareId = mid + '-' + S4() + new Date().getTime()
|
|
|
|
|
|
// TODO: 处理 pagesource
|
|
|
- let pageSource = video.head ? USER_SHARE_PAGESOURCE : RECOMMEND_PAGESOURCE
|
|
|
+ let pageSource = video.pageSource
|
|
|
|
|
|
- if (params.userSence !== USER_SENCE.share)
|
|
|
- pageSource = video.head ? DETAIL_PAGESOURCE : DETAIL_RECOMMEND
|
|
|
|
|
|
const userInfo = Taro.$global.get('userInfo')
|
|
|
|
|
|
const query = {
|
|
|
- userSence: USER_SENCE.share,
|
|
|
mid: mid,
|
|
|
rootMid: params.rootMid || mid,
|
|
|
shareId,
|
|
@@ -63,7 +60,6 @@ export function shareVideoToWechat(params) {
|
|
|
rootShareId: params.rootShareId || shareId,
|
|
|
|
|
|
shareDepth: +params.shareDepth + 1 || 0,
|
|
|
- isRecommendShare: video.isRecommendShare,
|
|
|
recommendSource: video.recommendSource,
|
|
|
recommendLogVO: video.recommendLogVO || '{}',
|
|
|
shareImageId: video.shareImgId,
|
|
@@ -97,10 +93,46 @@ function videoPlayParams(video) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+export function shareTimeline({ video, messageActionType = 'videoShareH5', rootPageSource = null }) {
|
|
|
+ const userInfo = Taro.$global.get('userInfo') || {}
|
|
|
+ const systemInfo = Taro.$global.get('systemInfo') || {}
|
|
|
+ const mid = Taro.$global.get('mid')
|
|
|
+ let { flowPool = '', pageSource, id = 0, isRecommendShare = false } = video
|
|
|
+ let session_from = {
|
|
|
+ platform: systemInfo.system,
|
|
|
+ appType: APP_TYPE,
|
|
|
+ token: userInfo ? userInfo.accessToken : '',
|
|
|
+ versionCode: VERSION_CODE,
|
|
|
+ pageSource,
|
|
|
+ machineCode: mid,
|
|
|
+ rootPageSource: rootPageSource || pageSource,
|
|
|
+ videoId: id,
|
|
|
+ flowPool: flowPool.replace(/#/g, '_'),
|
|
|
+ messageActionType,
|
|
|
+ isRecommendShare,
|
|
|
+ h5ShareIconClickTimeType: '0',
|
|
|
+ }
|
|
|
+ let fomr = {
|
|
|
+ "h5ShareIconClickTimeType": "0",
|
|
|
+ "kitPosition": "",
|
|
|
+ "kitType": "",
|
|
|
+ "kitId": "",
|
|
|
+ "entranceType": "weapp_shareH5Button",
|
|
|
+ "xcxAbinfo": "eyJhYl90ZXN0MDAxIjp7ImciOiJhYjkiLCJpZCI6IjIyMywzNDEifSwiYWJfdGVzdDAwMiI6eyJnIjoiYWI5IiwiaWQiOiIzODYsNTA3LDU1NiJ9LCJhYl90ZXN0MDAzIjp7ImciOiJhYjgiLCJpZCI6IjQ5OSw1NzIifSwiYWJfdGVzdDAwNCI6eyJnIjoiYWI5IiwiaWQiOiIyMTEsMTI2In0sImFiX3Rlc3QwMDUiOnsiZyI6ImFiMTYiLCJpZCI6IiJ9LCJhYl90ZXN0MDA2Ijp7ImciOiJhYjE5IiwiaWQiOiIyNTMsMzEwLDMxNCwzMTEsMzIxLDM1OSwzNTYsMzcxLDMzMSw0MzQsNTExLDUxMiw1MTMsNTgyIn0sImFiX3Rlc3QwMDciOnsiZyI6ImFiMTAwIiwiaWQiOiIifX01"
|
|
|
+ }
|
|
|
+
|
|
|
+ let obj = shareVideoToWechat({ video })
|
|
|
+ var msgPath = obj.path.replace(/%23/g, '_')
|
|
|
+ return {
|
|
|
+ session_from: JSON.stringify(session_from),
|
|
|
+ send_msg_title: video.shareTitle,
|
|
|
+ send_msg_img: 'https://weapppiccdn.yishihui.com/wxicon/wxOther/image/contact-share-h5-background-image.png',
|
|
|
+ send_msg_path: '/'.concat(msgPath)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 分享回流上报
|
|
|
export function returnedCrowdClickReport(params) {
|
|
|
- if (params.userSence !== USER_SENCE.share)
|
|
|
- return
|
|
|
|
|
|
shareClickReport({
|
|
|
shareId: params.shareId,
|