增加个人中心猜你喜欢埋点——review by 于良
Showing
4 changed files
with
57 additions
and
1 deletions
@@ -286,6 +286,21 @@ class MineContainer extends Component { | @@ -286,6 +286,21 @@ class MineContainer extends Component { | ||
286 | 286 | ||
287 | let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${productSkn}"}}`; | 287 | let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${productSkn}"}}`; |
288 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | 288 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); |
289 | + | ||
290 | + | ||
291 | + let productId = product && product.get('product_id', 0); | ||
292 | + let rec_id = this.props.mine.open.productListForMineCenter.rec_id; | ||
293 | + let rec_pose = '100004'; | ||
294 | + | ||
295 | + let chooseForYouParam = { | ||
296 | + 'PRD_ID': productId, | ||
297 | + 'PRD_NUM': parseInt(rowId)+1, | ||
298 | + 'ACTION_ID': 1, | ||
299 | + 'REC_ID': rec_id?rec_id:'', | ||
300 | + 'REC_POSE': rec_pose | ||
301 | + }; | ||
302 | + | ||
303 | + NativeModules.YH_CommonHelper.logEvent('YB_CHOOSE_FOR_YOU', chooseForYouParam); | ||
289 | } | 304 | } |
290 | 305 | ||
291 | _onLongPressProduct(rowID) { | 306 | _onLongPressProduct(rowID) { |
@@ -330,6 +330,7 @@ export function getProductListForMineCenter() { | @@ -330,6 +330,7 @@ export function getProductListForMineCenter() { | ||
330 | return new MineService(app.host).fetchMineCenterProductList() | 330 | return new MineService(app.host).fetchMineCenterProductList() |
331 | .then(json => { | 331 | .then(json => { |
332 | dispatch(productListForMineCenterSuccess(json)); | 332 | dispatch(productListForMineCenterSuccess(json)); |
333 | + dispatch(reportFavoriteData(json)); | ||
333 | }) | 334 | }) |
334 | .catch(error => { | 335 | .catch(error => { |
335 | dispatch(productListForMineCenterFailure()); | 336 | dispatch(productListForMineCenterFailure()); |
@@ -337,6 +338,43 @@ export function getProductListForMineCenter() { | @@ -337,6 +338,43 @@ export function getProductListForMineCenter() { | ||
337 | } | 338 | } |
338 | } | 339 | } |
339 | 340 | ||
341 | +function reportFavoriteData(payload) { | ||
342 | + return (dispatch, getState) => { | ||
343 | + try { | ||
344 | + let productList = payload.product_list; | ||
345 | + let rec_id = payload.rec_id; | ||
346 | + let total = payload.page_size; | ||
347 | + | ||
348 | + let rec_pos = '100004'; | ||
349 | + | ||
350 | + let productIDS = '' | ||
351 | + if (productList.length > 0) { | ||
352 | + let product = productList[0]; | ||
353 | + let product_id = product.product_id ? product.product_id : ''; | ||
354 | + productIDS = productIDS + product_id; | ||
355 | + } | ||
356 | + for (var i = 1; i < productList.length; i++) { | ||
357 | + let product = productList[i] | ||
358 | + let product_id = product.product_id ? product.product_id : ''; | ||
359 | + productIDS = productIDS + ',' + product_id; | ||
360 | + } | ||
361 | + let param = { | ||
362 | + 'PRD_ID': productIDS, | ||
363 | + 'PRD_NUM': total, | ||
364 | + 'REC_POSE': rec_pos, | ||
365 | + 'ACTION_ID': 0, | ||
366 | + 'REC_ID': rec_id?rec_id:'' | ||
367 | + }; | ||
368 | + ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_CHOOSE_FOR_YOU', param); | ||
369 | + | ||
370 | + } catch (e) { | ||
371 | + __DEV__ && console.error(e); | ||
372 | + } finally { | ||
373 | + | ||
374 | + } | ||
375 | + } | ||
376 | +} | ||
377 | + | ||
340 | export function getMineUserInfo() { | 378 | export function getMineUserInfo() { |
341 | return (dispatch, getState) => { | 379 | return (dispatch, getState) => { |
342 | let {app, mine} = getState(); | 380 | let {app, mine} = getState(); |
@@ -9,6 +9,7 @@ let InitialState = Record({ | @@ -9,6 +9,7 @@ let InitialState = Record({ | ||
9 | productListForMineCenter: new (Record({ | 9 | productListForMineCenter: new (Record({ |
10 | list: List(), | 10 | list: List(), |
11 | similarIndex: -1, | 11 | similarIndex: -1, |
12 | + rec_id:'', | ||
12 | })), | 13 | })), |
13 | mineCenterInfo: '', | 14 | mineCenterInfo: '', |
14 | })), | 15 | })), |
@@ -85,9 +85,11 @@ export default function appReducer(state = initialState, action) { | @@ -85,9 +85,11 @@ export default function appReducer(state = initialState, action) { | ||
85 | case MINECENTER_PRODUCT_SUCCESS: { | 85 | case MINECENTER_PRODUCT_SUCCESS: { |
86 | let { | 86 | let { |
87 | product_list, | 87 | product_list, |
88 | + rec_id, | ||
88 | } = action.payload; | 89 | } = action.payload; |
89 | 90 | ||
90 | - return state.setIn(['open', 'productListForMineCenter', 'list'], Immutable.fromJS(product_list)); | 91 | + return state.setIn(['open', 'productListForMineCenter', 'list'], Immutable.fromJS(product_list)) |
92 | + .setIn(['open', 'productListForMineCenter', 'rec_id'], rec_id); | ||
91 | } | 93 | } |
92 | 94 | ||
93 | case SET_SIMILAR_PRODUCT_INDEX: { | 95 | case SET_SIMILAR_PRODUCT_INDEX: { |
-
Please register or login to post a comment