Authored by 李犇

增加个人中心猜你喜欢埋点——review by 于良

... ... @@ -286,6 +286,21 @@ class MineContainer extends Component {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${productSkn}"}}`;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
let productId = product && product.get('product_id', 0);
let rec_id = this.props.mine.open.productListForMineCenter.rec_id;
let rec_pose = '100004';
let chooseForYouParam = {
'PRD_ID': productId,
'PRD_NUM': parseInt(rowId)+1,
'ACTION_ID': 1,
'REC_ID': rec_id?rec_id:'',
'REC_POSE': rec_pose
};
NativeModules.YH_CommonHelper.logEvent('YB_CHOOSE_FOR_YOU', chooseForYouParam);
}
_onLongPressProduct(rowID) {
... ...
... ... @@ -330,6 +330,7 @@ export function getProductListForMineCenter() {
return new MineService(app.host).fetchMineCenterProductList()
.then(json => {
dispatch(productListForMineCenterSuccess(json));
dispatch(reportFavoriteData(json));
})
.catch(error => {
dispatch(productListForMineCenterFailure());
... ... @@ -337,6 +338,43 @@ export function getProductListForMineCenter() {
}
}
function reportFavoriteData(payload) {
return (dispatch, getState) => {
try {
let productList = payload.product_list;
let rec_id = payload.rec_id;
let total = payload.page_size;
let rec_pos = '100004';
let productIDS = ''
if (productList.length > 0) {
let product = productList[0];
let product_id = product.product_id ? product.product_id : '';
productIDS = productIDS + product_id;
}
for (var i = 1; i < productList.length; i++) {
let product = productList[i]
let product_id = product.product_id ? product.product_id : '';
productIDS = productIDS + ',' + product_id;
}
let param = {
'PRD_ID': productIDS,
'PRD_NUM': total,
'REC_POSE': rec_pos,
'ACTION_ID': 0,
'REC_ID': rec_id?rec_id:''
};
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_CHOOSE_FOR_YOU', param);
} catch (e) {
__DEV__ && console.error(e);
} finally {
}
}
}
export function getMineUserInfo() {
return (dispatch, getState) => {
let {app, mine} = getState();
... ...
... ... @@ -9,6 +9,7 @@ let InitialState = Record({
productListForMineCenter: new (Record({
list: List(),
similarIndex: -1,
rec_id:'',
})),
mineCenterInfo: '',
})),
... ...
... ... @@ -85,9 +85,11 @@ export default function appReducer(state = initialState, action) {
case MINECENTER_PRODUCT_SUCCESS: {
let {
product_list,
rec_id,
} = action.payload;
return state.setIn(['open', 'productListForMineCenter', 'list'], Immutable.fromJS(product_list));
return state.setIn(['open', 'productListForMineCenter', 'list'], Immutable.fromJS(product_list))
.setIn(['open', 'productListForMineCenter', 'rec_id'], rec_id);
}
case SET_SIMILAR_PRODUCT_INDEX: {
... ...