Authored by ccbikai

product intro 替换

@@ -94,14 +94,20 @@ exports.intro = (req, res, next) => { @@ -94,14 +94,20 @@ exports.intro = (req, res, next) => {
94 return next(); 94 return next();
95 } 95 }
96 96
97 - introModel.getintroData({ 97 + introModel.getintroIntro({
98 productskn: req.params.productskn 98 productskn: req.params.productskn
99 - }, req).then((result) => {  
100 - res.render('detail/intro', {  
101 - result: result,  
102 - layout: false 99 + }, req).then(html => {
  100 + res.send(html);
103 }); 101 });
104 - }).catch(next); 102 +
  103 + // introModel.getintroData({
  104 + // productskn: req.params.productskn
  105 + // }, req).then((result) => {
  106 + // res.render('detail/intro', {
  107 + // result: result,
  108 + // layout: false
  109 + // });
  110 + // }).catch(next);
105 }; 111 };
106 112
107 /** 113 /**
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 */ 6 */
7 7
8 'use strict'; 8 'use strict';
9 - 9 +const $ = require('cheerio');
10 const _ = require('lodash'); 10 const _ = require('lodash');
11 11
12 // const log = require(`${library}/logger`); 12 // const log = require(`${library}/logger`);
@@ -339,6 +339,20 @@ let getintroData = (data, req) => { @@ -339,6 +339,20 @@ let getintroData = (data, req) => {
339 }); 339 });
340 }; 340 };
341 341
  342 +let getintroIntro = (data) => {
  343 + return api.get('', {
  344 + method: 'app.product.intro',
  345 + product_skn: data.productskn
  346 + }).then(result => {
  347 + result = $.load(result);
  348 +
  349 + result = result('#productDesc');
  350 +
  351 + return result.html();
  352 + });
  353 +};
  354 +
342 module.exports = { 355 module.exports = {
343 - getintroData 356 + getintroData,
  357 + getintroIntro
344 }; 358 };
@@ -17,8 +17,8 @@ module.exports = { @@ -17,8 +17,8 @@ module.exports = {
17 // api: 'http://devapi.yoho.cn:58078/', 17 // api: 'http://devapi.yoho.cn:58078/',
18 // service: 'http://devservice.yoho.cn:58077/' 18 // service: 'http://devservice.yoho.cn:58077/'
19 19
20 - api: 'http://testapi.yoho.cn:28078/',  
21 - service: 'http://testservice.yoho.cn:28077/' 20 + api: 'http://api.yoho.cn/',
  21 + service: 'http://service.yoho.cn/'
22 }, 22 },
23 subDomains: { 23 subDomains: {
24 host: '.m.yohobuy.com', 24 host: '.m.yohobuy.com',
@@ -33,6 +33,7 @@ @@ -33,6 +33,7 @@
33 "dependencies": { 33 "dependencies": {
34 "bluebird": "^3.4.1", 34 "bluebird": "^3.4.1",
35 "body-parser": "^1.15.2", 35 "body-parser": "^1.15.2",
  36 + "cheerio": "^0.22.0",
36 "connect-memcached": "^0.2.0", 37 "connect-memcached": "^0.2.0",
37 "cookie-parser": "^1.4.3", 38 "cookie-parser": "^1.4.3",
38 "express": "^4.14.0", 39 "express": "^4.14.0",