|
@@ -4,6 +4,7 @@ |
|
@@ -4,6 +4,7 @@ |
4
|
* @date: 2016/09/07
|
4
|
* @date: 2016/09/07
|
5
|
*/
|
5
|
*/
|
6
|
'use strict';
|
6
|
'use strict';
|
|
|
7
|
+const co = require('bluebird').coroutine;
|
7
|
const helpers = global.yoho.helpers;
|
8
|
const helpers = global.yoho.helpers;
|
8
|
const mRoot = '../models';
|
9
|
const mRoot = '../models';
|
9
|
const typeLib = require('../../../config/type-lib');
|
10
|
const typeLib = require('../../../config/type-lib');
|
|
@@ -344,10 +345,6 @@ const index = (req, res, next) => { |
|
@@ -344,10 +345,6 @@ const index = (req, res, next) => { |
344
|
|
345
|
|
345
|
res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","params":{"id":"${id}","share":"/guang/api/v1/share/guang?id=${id}","shareparam":{"id":"${id}"},"islogin":"N","type":1,"url":"http://guang.m.yohobuy.com/info/index","param":{"id":"${id}"}}}`;
|
346
|
res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","params":{"id":"${id}","share":"/guang/api/v1/share/guang?id=${id}","shareparam":{"id":"${id}"},"islogin":"N","type":1,"url":"http://guang.m.yohobuy.com/info/index","param":{"id":"${id}"}}}`;
|
346
|
|
347
|
|
347
|
- // pagecache 前端做
|
|
|
348
|
- // userAgent = req.get('User-Agent'),
|
|
|
349
|
- // isWeixin = userAgent.includes('MicroMessenger'); // 标识是否是微信访问
|
|
|
350
|
-
|
|
|
351
|
// 判断参数是否有效, 无效会跳转到错误页面
|
348
|
// 判断参数是否有效, 无效会跳转到错误页面
|
352
|
if (!stringProcess.isNumeric(id)) {
|
349
|
if (!stringProcess.isNumeric(id)) {
|
353
|
res.json({
|
350
|
res.json({
|
|
@@ -366,17 +363,8 @@ const index = (req, res, next) => { |
|
@@ -366,17 +363,8 @@ const index = (req, res, next) => { |
366
|
|
363
|
|
367
|
isShare = isWeixin || isqq || isWeibo ? true : false;
|
364
|
isShare = isWeixin || isqq || isWeibo ? true : false;
|
368
|
|
365
|
|
369
|
- // WAP上设置头部导航 pagecache
|
|
|
370
|
- // if (!isApp && !isWeixin) {
|
|
|
371
|
- // parameter = {
|
|
|
372
|
- // pageHeader: headerModel.setNav({
|
|
|
373
|
- // navTitle: title
|
|
|
374
|
- // })
|
|
|
375
|
- // };
|
|
|
376
|
- // }
|
|
|
377
|
-
|
|
|
378
|
- // 获取详情内容信息, 异常则跳到错误页面
|
|
|
379
|
- return req.ctx(DetailModel).packageData(id, isApp, isWeixin, channel, isShare).then(detail => {
|
366
|
+ co(function* () {
|
|
|
367
|
+ let detail = yield req.ctx(DetailModel).packageData(id, isApp, isWeixin, channel, isShare);
|
380
|
let data = {
|
368
|
let data = {
|
381
|
guangDetail: true,
|
369
|
guangDetail: true,
|
382
|
guang: {}
|
370
|
guang: {}
|
|
@@ -425,22 +413,16 @@ const index = (req, res, next) => { |
|
@@ -425,22 +413,16 @@ const index = (req, res, next) => { |
425
|
return next();
|
413
|
return next();
|
426
|
}
|
414
|
}
|
427
|
|
415
|
|
428
|
- guangProcess.processArticleDetail(detail.getArticleContent,
|
416
|
+ let processContents = guangProcess.processArticleDetail(detail.getArticleContent,
|
429
|
isApp,
|
417
|
isApp,
|
430
|
gender,
|
418
|
gender,
|
431
|
isWeixin,
|
419
|
isWeixin,
|
432
|
isqq,
|
420
|
isqq,
|
433
|
isWeibo);
|
421
|
isWeibo);
|
434
|
|
422
|
|
435
|
- // 生成内容部分
|
|
|
436
|
- return _pageArticleContent(detail.getArticleContent,
|
|
|
437
|
- isApp,
|
|
|
438
|
- gender,
|
|
|
439
|
- isWeixin,
|
|
|
440
|
- isqq,
|
|
|
441
|
- isWeibo).then((contents) => {
|
|
|
442
|
- // console.log(contents);
|
|
|
443
|
- guang.detail.content = contents;
|
423
|
+ let goodsList = yield req.ctx(DetailModel).productInfoBySkns(processContents.allgoods);
|
|
|
424
|
+
|
|
|
425
|
+ guang.detail.content = guangProcess.pushGoodsInfo(processContents.finalDetail, goodsList);
|
444
|
|
426
|
|
445
|
// 相关品牌
|
427
|
// 相关品牌
|
446
|
if (detail.getBrand && detail.getBrand.length) {
|
428
|
if (detail.getBrand && detail.getBrand.length) {
|
|
@@ -470,7 +452,9 @@ const index = (req, res, next) => { |
|
@@ -470,7 +452,9 @@ const index = (req, res, next) => { |
470
|
|
452
|
|
471
|
// 标识有微信分享
|
453
|
// 标识有微信分享
|
472
|
data.hasWxShare = true;
|
454
|
data.hasWxShare = true;
|
473
|
- aboutModel.about(req.yoho.isApp).then((resu) => {
|
455
|
+
|
|
|
456
|
+ let resu = aboutModel.about(req.yoho.isApp);
|
|
|
457
|
+
|
474
|
data.guang.wxFooter = resu;
|
458
|
data.guang.wxFooter = resu;
|
475
|
res.render('info/index', Object.assign({
|
459
|
res.render('info/index', Object.assign({
|
476
|
page: 'info-index',
|
460
|
page: 'info-index',
|
|
@@ -481,9 +465,7 @@ const index = (req, res, next) => { |
|
@@ -481,9 +465,7 @@ const index = (req, res, next) => { |
481
|
localCss: true,
|
465
|
localCss: true,
|
482
|
isShare: isShare
|
466
|
isShare: isShare
|
483
|
}, data, parameter));
|
467
|
}, data, parameter));
|
484
|
- });
|
|
|
485
|
- }).catch(next);
|
|
|
486
|
- }).catch(next);
|
468
|
+ })().catch(next);
|
487
|
};
|
469
|
};
|
488
|
|
470
|
|
489
|
// 301到新路由
|
471
|
// 301到新路由
|