Showing
3 changed files
with
45 additions
and
1 deletions
@@ -51,6 +51,39 @@ exports.index = (req, res, next) => { | @@ -51,6 +51,39 @@ exports.index = (req, res, next) => { | ||
51 | }; | 51 | }; |
52 | 52 | ||
53 | /** | 53 | /** |
54 | + * 商品基本信息 SKN 进入 | ||
55 | + * @param {[type]} req [description] | ||
56 | + * @param {[type]} res [description] | ||
57 | + * @return {[type]} [description] | ||
58 | + */ | ||
59 | +exports.indexSkn = (req, res, next) => { | ||
60 | + if (!req.params[0]) { | ||
61 | + return next(); | ||
62 | + } | ||
63 | + let uid = req.user.uid || 0; | ||
64 | + let headerData = headerModel.setNav({ | ||
65 | + navTitle: '商品详情' | ||
66 | + }); | ||
67 | + | ||
68 | + detailModel.getProductData({ | ||
69 | + productSkn: req.params[0], | ||
70 | + uid: uid, | ||
71 | + ua: req.get('user-agent') || '' | ||
72 | + }).then((result) => { | ||
73 | + if (_.isEmpty(result)) { | ||
74 | + return next(); | ||
75 | + } | ||
76 | + res.render('detail/detail', { | ||
77 | + pageHeader: headerData, | ||
78 | + result: result, | ||
79 | + page: 'detail', | ||
80 | + title: result.goodsName, | ||
81 | + pageFooter: true | ||
82 | + }); | ||
83 | + }).catch(next); | ||
84 | +}; | ||
85 | + | ||
86 | +/** | ||
54 | * 商品尺码信息详情 | 87 | * 商品尺码信息详情 |
55 | * @param {[type]} req [description] | 88 | * @param {[type]} req [description] |
56 | * @param {[type]} res [description] | 89 | * @param {[type]} res [description] |
@@ -571,10 +571,19 @@ const _getCommonConsult = () => { | @@ -571,10 +571,19 @@ const _getCommonConsult = () => { | ||
571 | let getProductData = (data) => { | 571 | let getProductData = (data) => { |
572 | let finalResult; | 572 | let finalResult; |
573 | let params = { | 573 | let params = { |
574 | - productId: _.toString(data.id), | ||
575 | method: 'h5.product.data' | 574 | method: 'h5.product.data' |
576 | }; | 575 | }; |
577 | 576 | ||
577 | + if (data.id) { // 通过 productId 获取商品详情 | ||
578 | + Object.assign(params, { | ||
579 | + productId: _.toString(data.id) | ||
580 | + }); | ||
581 | + } else if (data.productSkn) { // 通过 productSkn 获取商品详情 | ||
582 | + Object.assign(params, { | ||
583 | + product_skn: _.toString(data.productSkn) | ||
584 | + }); | ||
585 | + } | ||
586 | + | ||
578 | if (!_.isEmpty(data.uid)) { | 587 | if (!_.isEmpty(data.uid)) { |
579 | params.uid = data.uid; | 588 | params.uid = data.uid; |
580 | } | 589 | } |
@@ -25,6 +25,8 @@ const outlet = require(`${cRoot}/outlet`); | @@ -25,6 +25,8 @@ const outlet = require(`${cRoot}/outlet`); | ||
25 | 25 | ||
26 | // /pro_136349_455445/HEARTSOFARMianMaShuJiaoXiuXianKuPS1684.html | 26 | // /pro_136349_455445/HEARTSOFARMianMaShuJiaoXiuXianKuPS1684.html |
27 | router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.index); // 商品详情页 | 27 | router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.index); // 商品详情页 |
28 | +// /show_51047967.html | ||
29 | +router.get(/\/show_([\d]+)/, detail.indexSkn); // 商品详情页 SKN 进入 | ||
28 | router.get('/detail/intro/:productskn', detail.intro); // 商品内嵌页 | 30 | router.get('/detail/intro/:productskn', detail.intro); // 商品内嵌页 |
29 | router.get('/detail/preference', detail.preference); // 为你优选 | 31 | router.get('/detail/preference', detail.preference); // 为你优选 |
30 | router.get('/detail/consults', detail.consults); // 商品咨询页 | 32 | router.get('/detail/consults', detail.consults); // 商品咨询页 |
-
Please register or login to post a comment