Authored by 孙凯

add home product 数据自动曝光 review by hongmo

@@ -135,11 +135,13 @@ export default class ProductListCell extends Component { @@ -135,11 +135,13 @@ export default class ProductListCell extends Component {
135 render() { 135 render() {
136 let {data, sourceType, similarIndex, rowID, style} = this.props; 136 let {data, sourceType, similarIndex, rowID, style} = this.props;
137 let name = data.get('product_name') ? data.get('product_name') : ''; 137 let name = data.get('product_name') ? data.get('product_name') : '';
  138 + let yh_exposureData = data.get('yh_exposureData') ? data.get('yh_exposureData') : null;
138 139
139 return ( 140 return (
140 <TouchableOpacity 141 <TouchableOpacity
141 style={[styles.container, style]} 142 style={[styles.container, style]}
142 activeOpacity={1} 143 activeOpacity={1}
  144 + yh_exposureData={yh_exposureData}
143 onPress={() => { 145 onPress={() => {
144 if (rowID == similarIndex) { 146 if (rowID == similarIndex) {
145 this.props.onLongPressProduct&&this.props.onLongPressProduct(-1); 147 this.props.onLongPressProduct&&this.props.onLongPressProduct(-1);
@@ -5,6 +5,7 @@ import Immutable, {Map} from 'immutable'; @@ -5,6 +5,7 @@ import Immutable, {Map} from 'immutable';
5 5
6 const { 6 const {
7 Dimensions, 7 Dimensions,
  8 + Platform,
8 } = ReactNative; 9 } = ReactNative;
9 10
10 function channelCacheKey(channelKey) { 11 function channelCacheKey(channelKey) {
@@ -835,8 +836,14 @@ function parseBoyGirlFavorite(json, channel) { @@ -835,8 +836,14 @@ function parseBoyGirlFavorite(json, channel) {
835 let total = json && json.total ? json.total : 0; 836 let total = json && json.total ? json.total : 0;
836 837
837 let list = json && json.product_list ? json.product_list : []; 838 let list = json && json.product_list ? json.product_list : [];
838 - list = exposePruductListData(list, channel);  
839 let rec_id = json && json.rec_id ? json.rec_id : ''; 839 let rec_id = json && json.rec_id ? json.rec_id : '';
  840 + try {
  841 + list = exposePruductListData(list, channel,rec_id,-1);
  842 + } catch (e) {
  843 +
  844 + } finally {
  845 +
  846 + }
840 847
841 return { 848 return {
842 currentPage, 849 currentPage,
@@ -853,7 +860,13 @@ function parseKidsFavorite(json, channel) { @@ -853,7 +860,13 @@ function parseKidsFavorite(json, channel) {
853 let total = json && json.total ? json.total : 0; 860 let total = json && json.total ? json.total : 0;
854 861
855 let list = json && json.product_list ? json.product_list : []; 862 let list = json && json.product_list ? json.product_list : [];
856 - list = exposePruductListData(list, channel); 863 + try {
  864 + list = exposePruductListData(list, channel,'',-1);
  865 + } catch (e) {
  866 +
  867 + } finally {
  868 +
  869 + }
857 870
858 return { 871 return {
859 currentPage, 872 currentPage,
@@ -867,8 +880,15 @@ function parseLifeStyleFavorite(json, channel) { @@ -867,8 +880,15 @@ function parseLifeStyleFavorite(json, channel) {
867 let product_list = json && json.product_list ? json.product_list : {}; 880 let product_list = json && json.product_list ? json.product_list : {};
868 let newList = product_list && product_list.new ? product_list.new : []; 881 let newList = product_list && product_list.new ? product_list.new : [];
869 let hotList = product_list && product_list.top ? product_list.top : []; 882 let hotList = product_list && product_list.top ? product_list.top : [];
870 - newList = exposePruductListData(newList, channel);  
871 - hotList = exposePruductListData(hotList, channel); 883 + try {
  884 + newList = exposePruductListData(newList, channel,'',0);
  885 + hotList = exposePruductListData(hotList, channel,'',1);
  886 + } catch (e) {
  887 +
  888 + } finally {
  889 +
  890 + }
  891 +
872 return { 892 return {
873 newList, 893 newList,
874 hotList 894 hotList
@@ -1156,30 +1176,55 @@ function parseReportProductList(json) { @@ -1156,30 +1176,55 @@ function parseReportProductList(json) {
1156 return reportData; 1176 return reportData;
1157 } 1177 }
1158 1178
1159 -function exposePruductListData(list, channel=1) { 1179 +function exposePruductListData(list, channel ,rec_id,tab_id) {
1160 1180
1161 if (!list) { 1181 if (!list) {
1162 return list; 1182 return list;
1163 } 1183 }
1164 - let pageName = 'iFP_Home'  
1165 - let channlStr = 'boy';  
1166 - if (channel == 1) {  
1167 - channlStr = 'boy';  
1168 - }else if (channel == 2){  
1169 - channlStr = 'girl';  
1170 - }else if (channel == 3){  
1171 - channlStr = 'kid';  
1172 - }else if (channel == 4){  
1173 - channlStr = 'lifestyle'; 1184 + let rec_pose = '';
  1185 + if (channel == '1') {
  1186 + rec_pose = '100001';
  1187 + }else if (channel == '2'){
  1188 + rec_pose = '100002';
  1189 + }else if (channel == '3'){
  1190 + rec_pose = '100006';
  1191 + }else if (channel == '4'){
  1192 + rec_pose = '100011';
  1193 + }
  1194 +
  1195 + let pageName = 'iFP_Home';
  1196 +
  1197 + if (Platform.OS === 'android') {
  1198 + pageName = 'aFP_Home';
1174 } 1199 }
1175 1200
1176 for (var i = 0; i < list.length; i++) { 1201 for (var i = 0; i < list.length; i++) {
1177 let item = list[i]; 1202 let item = list[i];
1178 let skn = item.product_skn; 1203 let skn = item.product_skn;
1179 let inFloorIndex = parseInt(i) + 1 + ''; 1204 let inFloorIndex = parseInt(i) + 1 + '';
1180 - let params = autoReportData(channlStr,'','','',inFloorIndex,'',skn); 1205 + let params = {
  1206 + P_NAME : pageName,
  1207 + I_INDEX : inFloorIndex,
  1208 + PRD_SKN : skn,
  1209 + REC_POS : rec_pose,
  1210 + REC_ID : rec_id,
  1211 + exposureEnd : 1,
  1212 + };
  1213 +
  1214 + if (tab_id != -1) {
  1215 + params = {
  1216 + P_NAME : pageName,
  1217 + I_INDEX : inFloorIndex,
  1218 + PRD_SKN : skn,
  1219 + REC_POS : rec_pose,
  1220 + REC_ID : rec_id,
  1221 + TAB_ID : tab_id,
  1222 + exposureEnd : 1,
  1223 + };
  1224 + }
1181 item.yh_exposureData = params; 1225 item.yh_exposureData = params;
1182 } 1226 }
  1227 +
1183 return list; 1228 return list;
1184 } 1229 }
1185 1230