Authored by zhangxiaoru

增加app_type

@@ -31,7 +31,6 @@ const index = (req, res, next) => { @@ -31,7 +31,6 @@ const index = (req, res, next) => {
31 } 31 }
32 32
33 brandModel.indexData(gender, brandCode, cateCode).then(result => { 33 brandModel.indexData(gender, brandCode, cateCode).then(result => {
34 - // console.log(result)  
35 34
36 res.render('brand/brand', { 35 res.render('brand/brand', {
37 module: 'guang', 36 module: 'guang',
@@ -84,7 +83,9 @@ const categoryData = (req, res, next) => { @@ -84,7 +83,9 @@ const categoryData = (req, res, next) => {
84 83
85 // 全部分类 84 // 全部分类
86 const cateAll = (req, res, next) => { 85 const cateAll = (req, res, next) => {
87 - brandModel.getCateData(req.yoho.channel).then((result) => { 86 + let appType = req.query.app_type || 0;
  87 +
  88 + brandModel.getCateData(req.yoho.channel, appType).then((result) => {
88 res.render('brand/cate-all', { 89 res.render('brand/cate-all', {
89 module: 'guang', 90 module: 'guang',
90 page: 'cate-all', 91 page: 'cate-all',
@@ -17,10 +17,8 @@ const yhChannel = { @@ -17,10 +17,8 @@ const yhChannel = {
17 }; 17 };
18 18
19 const genderMap = { 19 const genderMap = {
20 - boys: '1,3',  
21 - girls: '2,3',  
22 - kids: '1,2,3',  
23 - lifestyle: '1,2,3' 20 + MEN男士: '1,3',
  21 + WOMEN女士: '2,3'
24 }; 22 };
25 23
26 const channelNav = { 24 const channelNav = {
@@ -54,7 +52,7 @@ const handleBrandList = origin => { @@ -54,7 +52,7 @@ const handleBrandList = origin => {
54 name: subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name, 52 name: subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name,
55 logo: subValue.brand_ico, 53 logo: subValue.brand_ico,
56 domain: subValue.brand_domain, 54 domain: subValue.brand_domain,
57 - brandUrl: '//m.yohobuy.com/product/index/brand?domain=' + subValue.brand_domain 55 + brandUrl: '//m.yohobuy.com/product/index/brand?domain=' + subValue.brand_domain + '&app_type=1'
58 }); 56 });
59 }); 57 });
60 58
@@ -165,7 +163,7 @@ const _getBrandListOriginData = (channel) => { @@ -165,7 +163,7 @@ const _getBrandListOriginData = (channel) => {
165 }); 163 });
166 }; 164 };
167 165
168 -const _processCateData = (list, channel) => { 166 +const _processCateData = (list, channel, appType) => {
169 let nav = ['MEN男士', 'WOMEN女士']; 167 let nav = ['MEN男士', 'WOMEN女士'];
170 168
171 nav = _.map(nav, function(item) { 169 nav = _.map(nav, function(item) {
@@ -186,7 +184,8 @@ const _processCateData = (list, channel) => { @@ -186,7 +184,8 @@ const _processCateData = (list, channel) => {
186 secondItem.url = helpers.urlFormat('/', { 184 secondItem.url = helpers.urlFormat('/', {
187 sort: _.get(secondItem, 'relation_parameter.sort'), 185 sort: _.get(secondItem, 'relation_parameter.sort'),
188 sort_name: secondItem.category_name, 186 sort_name: secondItem.category_name,
189 - gender: genderMap[key] || '' 187 + gender: genderMap[key] || '',
  188 + app_type: appType
190 }, 'list'); 189 }, 'list');
191 }); 190 });
192 191
@@ -195,14 +194,16 @@ const _processCateData = (list, channel) => { @@ -195,14 +194,16 @@ const _processCateData = (list, channel) => {
195 url: helpers.urlFormat('/', { 194 url: helpers.urlFormat('/', {
196 sort: _.get(firstItem, 'relation_parameter.sort'), 195 sort: _.get(firstItem, 'relation_parameter.sort'),
197 sort_name: firstItem.category_name, 196 sort_name: firstItem.category_name,
198 - gender: genderMap[key] || '' 197 + gender: genderMap[key] || '',
  198 + app_type: appType
199 }, 'list') 199 }, 'list')
200 }); 200 });
201 } else { 201 } else {
202 firstItem.url = helpers.urlFormat('/', { 202 firstItem.url = helpers.urlFormat('/', {
203 sort: _.get(firstItem, 'relation_parameter.sort'), 203 sort: _.get(firstItem, 'relation_parameter.sort'),
204 sort_name: firstItem.category_name, 204 sort_name: firstItem.category_name,
205 - gender: genderMap[key] || '' 205 + gender: genderMap[key] || '',
  206 + app_type: appType
206 }, 'list'); 207 }, 'list');
207 } 208 }
208 }); 209 });
@@ -221,10 +222,10 @@ const _dealBrandUrl = (list) => { @@ -221,10 +222,10 @@ const _dealBrandUrl = (list) => {
221 domain = val.url.substring(val.url.indexOf('shop/') + 5, val.url.indexOf('?')); 222 domain = val.url.substring(val.url.indexOf('shop/') + 5, val.url.indexOf('?'));
222 223
223 val.url = '//m.yohobuy.com/product/index/brand?domain=' + domain; 224 val.url = '//m.yohobuy.com/product/index/brand?domain=' + domain;
224 - }) 225 + });
225 226
226 return list; 227 return list;
227 -} 228 +};
228 229
229 const indexData = (gender, brandCode, cateCode) => { 230 const indexData = (gender, brandCode, cateCode) => {
230 return Promise.all([_getChannelData(gender), _getResourcesData(brandCode), _getBrandListOriginData(gender), _getResourcesData(cateCode)]).then(result => { 231 return Promise.all([_getChannelData(gender), _getResourcesData(brandCode), _getBrandListOriginData(gender), _getResourcesData(cateCode)]).then(result => {
@@ -240,7 +241,7 @@ const indexData = (gender, brandCode, cateCode) => { @@ -240,7 +241,7 @@ const indexData = (gender, brandCode, cateCode) => {
240 if (result[1]) { 241 if (result[1]) {
241 _.forEach(result[1], function(data) { 242 _.forEach(result[1], function(data) {
242 if (data.focus_type === '1') { 243 if (data.focus_type === '1') {
243 - 244 +
244 brandList.bannerTop = _dealBrandUrl(data); 245 brandList.bannerTop = _dealBrandUrl(data);
245 } else if (data.focus_type === '2') { 246 } else if (data.focus_type === '2') {
246 247
@@ -262,13 +263,13 @@ const indexData = (gender, brandCode, cateCode) => { @@ -262,13 +263,13 @@ const indexData = (gender, brandCode, cateCode) => {
262 var param = val.url.substring(val.url.indexOf('list?') + 5); 263 var param = val.url.substring(val.url.indexOf('list?') + 5);
263 264
264 val.url = '//list.m.yohobuy.com/?' + param; 265 val.url = '//list.m.yohobuy.com/?' + param;
265 - }) 266 + });
266 categoryData.list = data.data.list; 267 categoryData.list = data.data.list;
267 } else if (data.template_name === 'focus') { 268 } else if (data.template_name === 'focus') {
268 _.forEach(data.data, function(val) { 269 _.forEach(data.data, function(val) {
269 270
270 val.url = '//m.yohobuy.com/guang/cate-all'; 271 val.url = '//m.yohobuy.com/guang/cate-all';
271 - }) 272 + });
272 categoryData.focusData = data; 273 categoryData.focusData = data;
273 } 274 }
274 }); 275 });
@@ -318,13 +319,13 @@ const categoryData = (code) => { @@ -318,13 +319,13 @@ const categoryData = (code) => {
318 var param = val.url.substring(val.url.indexOf('list?') + 5); 319 var param = val.url.substring(val.url.indexOf('list?') + 5);
319 320
320 val.url = '//list.m.yohobuy.com/?' + param; 321 val.url = '//list.m.yohobuy.com/?' + param;
321 - }) 322 + });
322 category.list = data.data.list; 323 category.list = data.data.list;
323 } else if (data.template_name === 'focus') { 324 } else if (data.template_name === 'focus') {
324 _.forEach(data.data, function(val) { 325 _.forEach(data.data, function(val) {
325 326
326 val.url = '//m.yohobuy.com/guang/cate-all'; 327 val.url = '//m.yohobuy.com/guang/cate-all';
327 - }) 328 + });
328 329
329 category.focusData = data; 330 category.focusData = data;
330 } 331 }
@@ -336,7 +337,7 @@ const categoryData = (code) => { @@ -336,7 +337,7 @@ const categoryData = (code) => {
336 }); 337 });
337 }; 338 };
338 339
339 -const getCateData = (channel) => { 340 +const getCateData = (channel, appType) => {
340 return api.get('', { 341 return api.get('', {
341 method: 'app.sort.get', 342 method: 'app.sort.get',
342 app_type: 1 343 app_type: 1
@@ -353,9 +354,10 @@ const getCateData = (channel) => { @@ -353,9 +354,10 @@ const getCateData = (channel) => {
353 // _.unset(result.data, 'boy'); 354 // _.unset(result.data, 'boy');
354 // _.unset(result.data, 'girl'); 355 // _.unset(result.data, 'girl');
355 356
  357 +
356 return result.data; 358 return result.data;
357 }).then((list) => { 359 }).then((list) => {
358 - return _processCateData(list, channel); 360 + return _processCateData(list, channel, appType);
359 }); 361 });
360 }; 362 };
361 363
@@ -10,7 +10,6 @@ @@ -10,7 +10,6 @@
10 10
11 <div class="focus-floor"> 11 <div class="focus-floor">
12 {{# focusData}} 12 {{# focusData}}
13 - {{!-- {{{log this}}} --}}  
14 {{> resources/banner-top}} 13 {{> resources/banner-top}}
15 {{/ focusData}} 14 {{/ focusData}}
16 </div> 15 </div>
@@ -98,7 +98,6 @@ const shop = { @@ -98,7 +98,6 @@ const shop = {
98 }); 98 });
99 } 99 }
100 }).then((isBrand) => { 100 }).then((isBrand) => {
101 - // console.log(params);  
102 if (isBrand) { 101 if (isBrand) {
103 res.render('newshop/brand', { 102 res.render('newshop/brand', {
104 module: 'product', 103 module: 'product',
@@ -128,6 +127,7 @@ const shop = { @@ -128,6 +127,7 @@ const shop = {
128 let uid = req.user.uid; 127 let uid = req.user.uid;
129 let channel = req.yoho.channel || 'boys'; 128 let channel = req.yoho.channel || 'boys';
130 let pageHeader = {}; 129 let pageHeader = {};
  130 + let appType = req.query.app_type;
131 131
132 // pagecache前端判断 132 // pagecache前端判断
133 if (!isApp) { 133 if (!isApp) {
@@ -157,6 +157,7 @@ const shop = { @@ -157,6 +157,7 @@ const shop = {
157 let searchParam = { 157 let searchParam = {
158 isApp: req.yoho.isApp, 158 isApp: req.yoho.isApp,
159 shop_id: shopId, 159 shop_id: shopId,
  160 + app_type: appType,
160 type: 'default', 161 type: 'default',
161 order: '0', 162 order: '0',
162 page: 1, 163 page: 1,
@@ -200,6 +201,7 @@ const shop = { @@ -200,6 +201,7 @@ const shop = {
200 } else { 201 } else {
201 // 经典装修店铺 202 // 经典装修店铺
202 return Promise.all([listModel.getShopDecorator(shopId).then(), listModel.getShopCategoryApi(shopId, channel)]).then(fResult => { 203 return Promise.all([listModel.getShopDecorator(shopId).then(), listModel.getShopCategoryApi(shopId, channel)]).then(fResult => {
  204 +
203 let shopDeco = fResult[0]; 205 let shopDeco = fResult[0];
204 let shopCategory = fResult[1]; 206 let shopCategory = fResult[1];
205 207
@@ -189,6 +189,7 @@ const search = (req, res, next) => { @@ -189,6 +189,7 @@ const search = (req, res, next) => {
189 189
190 params.isApp = req.yoho.isApp; 190 params.isApp = req.yoho.isApp;
191 params.limit = 24; 191 params.limit = 24;
  192 +
192 searchModel.getSearchData(params).then((result) => { 193 searchModel.getSearchData(params).then((result) => {
193 194
194 if (result && result.list && 195 if (result && result.list &&
@@ -128,6 +128,10 @@ const _searchGoods = (params) => { @@ -128,6 +128,10 @@ const _searchGoods = (params) => {
128 params.query = params.query.replace(/\+/g, ','); 128 params.query = params.query.replace(/\+/g, ',');
129 } 129 }
130 130
  131 + if (params.app_type && params.app_type === '1') {
  132 + params.app_type = 1;
  133 + }
  134 +
131 params = _.assign({ 135 params = _.assign({
132 limit: '60', 136 limit: '60',
133 status: 1, 137 status: 1,
@@ -176,6 +180,7 @@ const _searchGoods = (params) => { @@ -176,6 +180,7 @@ const _searchGoods = (params) => {
176 * 获取商品数据 180 * 获取商品数据
177 */ 181 */
178 const getSearchData = (params) => { 182 const getSearchData = (params) => {
  183 +
179 return _searchGoods(params).then((result) => { 184 return _searchGoods(params).then((result) => {
180 if (result && result.code === 200) { 185 if (result && result.code === 200) {
181 let newList = {}; 186 let newList = {};