Authored by htoooth

remove fake data

@@ -124,7 +124,7 @@ module.exports.createConsult = (req, res, next) => { @@ -124,7 +124,7 @@ module.exports.createConsult = (req, res, next) => {
124 code: 403, 124 code: 403,
125 message: '用户没有登录', 125 message: '用户没有登录',
126 data: { 126 data: {
127 - url: helpers.urlFormat('signin.html') 127 + url: helpers.urlFormat('/signin.html')
128 } 128 }
129 }); 129 });
130 130
@@ -6,24 +6,19 @@ const sign = require(`${library}/sign`); @@ -6,24 +6,19 @@ const sign = require(`${library}/sign`);
6 6
7 const api = new API(); 7 const api = new API();
8 8
9 -const fake = require('./fake');  
10 -  
11 module.exports.getBannerInfoAsync = (bid) => { 9 module.exports.getBannerInfoAsync = (bid) => {
12 - //return api.get('', sign.apiSign({  
13 - // method: 'web.brand.banner',  
14 - // brand_id: bid  
15 - //})); 10 + return api.get('', sign.apiSign({
  11 + method: 'web.brand.banner',
  12 + brand_id: bid
  13 + }));
16 14
17 - return Promise.resolve(fake.fakeBrandBanner);  
18 }; 15 };
19 16
20 module.exports.getBrandLogoByDomainAsync = (domain) => { 17 module.exports.getBrandLogoByDomainAsync = (domain) => {
21 - //return api.get('', sign.apiSign({  
22 - // domain: domain,  
23 - // method: 'web.brand.byDomain'  
24 - //}));  
25 -  
26 - return Promise.resolve(fake.fakeBrandDomain); 18 + return api.get('', sign.apiSign({
  19 + domain: domain,
  20 + method: 'web.brand.byDomain'
  21 + }));
27 }; 22 };
28 23
29 24
@@ -15,38 +15,36 @@ const api = require('./detail-comment-api'); @@ -15,38 +15,36 @@ const api = require('./detail-comment-api');
15 15
16 const detailHelper = require('./detail-helper'); 16 const detailHelper = require('./detail-helper');
17 17
18 -const fake = require('./fake');  
19 18
20 module.exports.indexAsync = (pid, page, size) => { 19 module.exports.indexAsync = (pid, page, size) => {
21 return co(function *() { 20 return co(function *() {
22 - return fake.fakeComments;  
23 - //let commentList = yield api.indexAsync(pid, page, size);  
24 - //  
25 - //if (!commentList.code || !commentList.code !== 200) {  
26 - // return [];  
27 - //}  
28 -  
29 -  
30 - //return commentList.data.map(value => {  
31 - // let item = {};  
32 - //  
33 - // let avatar = detailHelper.DEFAULT_AVATAR_ICO;  
34 - //  
35 - // if (value.head_ico) {  
36 - // avatar = `${detailHelper.IMAGE_SERVICE_URL}${_.last(value.head_ico.split('headimg'))}`;  
37 - // avatar = helpers.image(avatar, 30, 30);  
38 - // }  
39 - //  
40 - // item.avatar = avatar;  
41 - // item.userName = value.nickname;  
42 - // item.color = value.color_name;  
43 - // item.size = value.size_name;  
44 - // item.comment = value.content || '';  
45 - // item.date = value.create_time;  
46 - // item.total = value.total;  
47 - //  
48 - // return item;  
49 - //}); 21 + let commentList = yield api.indexAsync(pid, page, size);
  22 +
  23 + if (!commentList.code || !commentList.code !== 200) {
  24 + return [];
  25 + }
  26 +
  27 +
  28 + return commentList.data.map(value => {
  29 + let item = {};
  30 +
  31 + let avatar = detailHelper.DEFAULT_AVATAR_ICO;
  32 +
  33 + if (value.head_ico) {
  34 + avatar = `${detailHelper.IMAGE_SERVICE_URL}${_.last(value.head_ico.split('headimg'))}`;
  35 + avatar = helpers.image(avatar, 30, 30);
  36 + }
  37 +
  38 + item.avatar = avatar;
  39 + item.userName = value.nickname;
  40 + item.color = value.color_name;
  41 + item.size = value.size_name;
  42 + item.comment = value.content || '';
  43 + item.date = value.create_time;
  44 + item.total = value.total;
  45 +
  46 + return item;
  47 + });
50 48
51 })(); 49 })();
52 }; 50 };
@@ -10,33 +10,29 @@ const co = Promise.coroutine; @@ -10,33 +10,29 @@ const co = Promise.coroutine;
10 const api = require('./detail-consult-api'); 10 const api = require('./detail-consult-api');
11 const detailHelper = require('./detail-helper'); 11 const detailHelper = require('./detail-helper');
12 12
13 -const fake = require('./fake');  
14 13
15 module.exports.indexAsync = (uid, pid, page, size) => { 14 module.exports.indexAsync = (uid, pid, page, size) => {
16 return co(function *() { 15 return co(function *() {
17 - return fake.fakeConsule;  
18 -  
19 -  
20 - //let consultList = yield api.indexAsync(uid, pid, page, size);  
21 - //  
22 - //if (!consultList.code || consultList.code !== 200) {  
23 - // return [];  
24 - //}  
25 - //  
26 - //return consultList.data.list.map(value => {  
27 - // return {  
28 - // avatar: detailHelper.DEFAULT_AVATAR_ICO,  
29 - // question: value.ask,  
30 - // date: value.ask_time,  
31 - // answer: value.answer,  
32 - // id: value.id,  
33 - // isLike: value.is_like === 'Y',  
34 - // like: parseInt(value.like, 10),  
35 - // isUseful: value.is_useful === 'Y',  
36 - // useful: parseInt(value.useful, 10),  
37 - // total: value.total  
38 - // };  
39 - //}); 16 + let consultList = yield api.indexAsync(uid, pid, page, size);
  17 +
  18 + if (!consultList.code || consultList.code !== 200) {
  19 + return [];
  20 + }
  21 +
  22 + return consultList.data.list.map(value => {
  23 + return {
  24 + avatar: detailHelper.DEFAULT_AVATAR_ICO,
  25 + question: value.ask,
  26 + date: value.ask_time,
  27 + answer: value.answer,
  28 + id: value.id,
  29 + isLike: value.is_like === 'Y',
  30 + like: parseInt(value.like, 10),
  31 + isUseful: value.is_useful === 'Y',
  32 + useful: parseInt(value.useful, 10),
  33 + total: value.total
  34 + };
  35 + });
40 36
41 })(); 37 })();
42 }; 38 };
@@ -9,15 +9,12 @@ const log = require(`${library}/logger`); @@ -9,15 +9,12 @@ const log = require(`${library}/logger`);
9 9
10 const api = new API(); 10 const api = new API();
11 11
12 -const fake = require('./fake');  
13 /** 12 /**
14 * 获取商品的热区 13 * 获取商品的热区
15 */ 14 */
16 module.exports.indexAsync = (pid) => { 15 module.exports.indexAsync = (pid) => {
17 - //return api.get('', sign.apiSign({  
18 - // method: 'web.productCollocation.list',  
19 - // product_id: pid  
20 - //})).catch(log.error);  
21 -  
22 - return Promise.resolve(fake.fakeProductCollent); 16 + return api.get('', sign.apiSign({
  17 + method: 'web.productCollocation.list',
  18 + product_id: pid
  19 + })).catch(log.error);
23 }; 20 };
@@ -8,53 +8,45 @@ const log = require(`${library}/logger`); @@ -8,53 +8,45 @@ const log = require(`${library}/logger`);
8 8
9 const api = new API(); 9 const api = new API();
10 10
11 -const fake = require('./fake');  
12 11
13 module.exports.getProductBannerAsync = function(pid, clientType) { 12 module.exports.getProductBannerAsync = function(pid, clientType) {
14 - //clientType = clientType || 'web';  
15 - //return api.get('', sign.apiSign({  
16 - // method: 'web.productBanner.data',  
17 - // product_id: pid,  
18 - // client_type: clientType  
19 - //})).catch(log.error);  
20 -  
21 - return Promise.resolve(fake.fakeProductBanner); 13 + clientType = clientType || 'web';
  14 + return api.get('', sign.apiSign({
  15 + method: 'web.productBanner.data',
  16 + product_id: pid,
  17 + client_type: clientType
  18 + })).catch(log.error);
  19 +
22 }; 20 };
23 21
24 module.exports.sizeInfoAsync = function(skn) { 22 module.exports.sizeInfoAsync = function(skn) {
25 - //return api.get('', sign.apiSign({  
26 - // method: 'h5.product.intro',  
27 - // productskn: skn  
28 - //})).catch(log.error); 23 + return api.get('', sign.apiSign({
  24 + method: 'h5.product.intro',
  25 + productskn: skn
  26 + })).catch(log.error);
29 27
30 - return Promise.resolve(fake.fakeProductIntro);  
31 }; 28 };
32 29
33 module.exports.getProductComfortAsync = function(pid) { 30 module.exports.getProductComfortAsync = function(pid) {
34 - //return api.get('', sign.apiSign({  
35 - // method: 'web.productComfort.data',  
36 - // product_id: pid  
37 - //})).catch(log.error); 31 + return api.get('', sign.apiSign({
  32 + method: 'web.productComfort.data',
  33 + product_id: pid
  34 + })).catch(log.error);
38 35
39 - return Promise.resolve(fake.fakeComfort);  
40 }; 36 };
41 37
42 module.exports.getProductModelCardAsync = function(pid) { 38 module.exports.getProductModelCardAsync = function(pid) {
43 - //return api.get('', sign.apiSign({  
44 - // method: 'web.productModelcard.list',  
45 - // product_id: pid  
46 - //})).catch(log.error);  
47 -  
48 - return Promise.resolve(fake.fakeModelCard); 39 + return api.get('', sign.apiSign({
  40 + method: 'web.productModelcard.list',
  41 + product_id: pid
  42 + })).catch(log.error);
49 }; 43 };
50 44
51 module.exports.getProductModelTryAsync = function(skn) { 45 module.exports.getProductModelTryAsync = function(skn) {
52 - //return api.get('', sign.apiSign({  
53 - // method: 'web.productModelTry.data',  
54 - // product_skn: skn  
55 - //})).catch(log.error);  
56 -  
57 - return Promise.resolve(fake.fakeModelTry); 46 + return api.get('', sign.apiSign({
  47 + method: 'web.productModelTry.data',
  48 + product_skn: skn
  49 + })).catch(log.error);
58 }; 50 };
59 51
60 /** 52 /**
@@ -63,12 +55,10 @@ module.exports.getProductModelTryAsync = function(skn) { @@ -63,12 +55,10 @@ module.exports.getProductModelTryAsync = function(skn) {
63 * @returns {Promise.<type>} 55 * @returns {Promise.<type>}
64 */ 56 */
65 module.exports.getProductInfo = function(pid) { 57 module.exports.getProductInfo = function(pid) {
66 - //return api.get('', sign.apiSign({  
67 - // method: 'h5.product.data',  
68 - // productId: pid  
69 - //})).catch(console.log);  
70 -  
71 - return Promise.resolve(fake.fakeProduct); 58 + return api.get('', sign.apiSign({
  59 + method: 'h5.product.data',
  60 + productId: pid
  61 + })).catch(console.log);
72 }; 62 };
73 63
74 64
@@ -27,7 +27,6 @@ const shopAPI = require('./shop-api'); @@ -27,7 +27,6 @@ const shopAPI = require('./shop-api');
27 const searchAPI = require('./search-api'); 27 const searchAPI = require('./search-api');
28 const homeService = require('./home-service'); 28 const homeService = require('./home-service');
29 const HeaderModel = require('../../../doraemon/models/header'); 29 const HeaderModel = require('../../../doraemon/models/header');
30 -const fake = require('./fake');  
31 30
32 const BLANK_STR = ' '; 31 const BLANK_STR = ' ';
33 32
@@ -1281,7 +1280,8 @@ const getSizeInfo = (productSkn, maxSortId)=> { @@ -1281,7 +1280,8 @@ const getSizeInfo = (productSkn, maxSortId)=> {
1281 1280
1282 // 模特数据 1281 // 模特数据
1283 let reference = getReferenceDataBySizeInfo(sizeInfo); 1282 let reference = getReferenceDataBySizeInfo(sizeInfo);
1284 - if(_.isEmpty(reference)){ 1283 +
  1284 + if (_.isEmpty(reference)) {
1285 result.reference = reference; 1285 result.reference = reference;
1286 } 1286 }
1287 1287
This diff could not be displayed because it is too large.
@@ -6,11 +6,7 @@ const log = require(`${library}/logger`); @@ -6,11 +6,7 @@ const log = require(`${library}/logger`);
6 6
7 const api = new API(); 7 const api = new API();
8 8
9 -const fake = require('./fake');  
10 -  
11 module.exports.getSortByConditionAsync = function(condition) { 9 module.exports.getSortByConditionAsync = function(condition) {
12 - //return api.get('sortgroup.json', condition).catch(log.error);  
13 -  
14 - return Promise.resolve(fake.fakeNav); 10 + return api.get('sortgroup.json', condition).catch(log.error);
15 }; 11 };
16 12
@@ -15,9 +15,6 @@ const serviceApi = new ServiceAPI(); @@ -15,9 +15,6 @@ const serviceApi = new ServiceAPI();
15 15
16 const log = require(`${global.library}/logger`); 16 const log = require(`${global.library}/logger`);
17 17
18 -const Promise = require('bluebird');  
19 -const fake = require('../../apps/product/models/fake');  
20 -  
21 /** 18 /**
22 * 获取菜单 19 * 获取菜单
23 * @param undefined 20 * @param undefined
@@ -204,17 +201,7 @@ exports.requestHeaderData = (type, parentId) => { @@ -204,17 +201,7 @@ exports.requestHeaderData = (type, parentId) => {
204 201
205 type = type || 'boys'; 202 type = type || 'boys';
206 203
207 - //return serviceApi.get('operations/api/v6/category/getCategory', data, true).then(res => {  
208 - // if (res && res.code === 200) {  
209 - // return setHeaderData(res.data, type);  
210 - // } else {  
211 - // log.error('获取头部信息的接口返回状态码 不是 200');  
212 - // return {};  
213 - // }  
214 - //});  
215 -  
216 - return Promise.resolve(fake.fakeHeader).then(res => {  
217 - console.log(res); 204 + return serviceApi.get('operations/api/v6/category/getCategory', data, true).then(res => {
218 if (res && res.code === 200) { 205 if (res && res.code === 200) {
219 return setHeaderData(res.data, type); 206 return setHeaderData(res.data, type);
220 } else { 207 } else {