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
@@ -435,41 +434,41 @@ const getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { @@ -435,41 +434,41 @@ const getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => {
435 // 显示获取限购码按钮 434 // 显示获取限购码按钮
436 switch (showStatus) { 435 switch (showStatus) {
437 case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码) 436 case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码)
438 - {  
439 - if (isBeginSale) { 437 + {
  438 + if (isBeginSale) {
  439 + result.buyNow = true;
  440 + result.dis = true;
  441 + } else {
  442 + result.openSoon = true;
  443 + result.hasLimitedCode = false;
  444 + }
  445 + break;
  446 + }
  447 + case 2: // 开售后,限购码已抢光(用户未领取限购码)
  448 + {
440 result.buyNow = true; 449 result.buyNow = true;
441 result.dis = true; 450 result.dis = true;
442 - } else {  
443 - result.openSoon = true; 451 + result.limitedCodeSoldOut = true;
  452 + result.getLimitedCode = false;
444 result.hasLimitedCode = false; 453 result.hasLimitedCode = false;
  454 + break;
445 } 455 }
446 - break;  
447 - }  
448 - case 2: // 开售后,限购码已抢光(用户未领取限购码)  
449 - {  
450 - result.buyNow = true;  
451 - result.dis = true;  
452 - result.limitedCodeSoldOut = true;  
453 - result.getLimitedCode = false;  
454 - result.hasLimitedCode = false;  
455 - break;  
456 - }  
457 case 3: // 开售后,商品已经售罄 456 case 3: // 开售后,商品已经售罄
458 - {  
459 - result.soldOut = true;  
460 - result.getLimitedCode = false;  
461 - break;  
462 - } 457 + {
  458 + result.soldOut = true;
  459 + result.getLimitedCode = false;
  460 + break;
  461 + }
463 case 4:// 开售后,立即购买(用户已领取限购码) 462 case 4:// 开售后,立即购买(用户已领取限购码)
464 - {  
465 - result.buyNow = true;  
466 - result.dis = false;  
467 - result.hasLimitedCode = true;  
468 - if (uid) { // 限购码失效  
469 - result.getLimitedCodeDis = true; 463 + {
  464 + result.buyNow = true;
  465 + result.dis = false;
  466 + result.hasLimitedCode = true;
  467 + if (uid) { // 限购码失效
  468 + result.getLimitedCodeDis = true;
  469 + }
  470 + break;
470 } 471 }
471 - break;  
472 - }  
473 case 5: // 开售前,限购码已被抢光(用户未领取限购码) 472 case 5: // 开售前,限购码已被抢光(用户未领取限购码)
474 result.openSoon = true; 473 result.openSoon = true;
475 result.hasLimitedCode = true; 474 result.hasLimitedCode = true;
@@ -736,19 +735,19 @@ const detailDataPkg = (origin, uid, vipLevel) => { @@ -736,19 +735,19 @@ const detailDataPkg = (origin, uid, vipLevel) => {
736 if (domainBrand.type && domainBrand.shopId) { 735 if (domainBrand.type && domainBrand.shopId) {
737 switch (parseInt(domainBrand.type)) { 736 switch (parseInt(domainBrand.type)) {
738 case 1: 737 case 1:
739 - { 738 + {
740 // 多品店不显示 739 // 多品店不显示
741 - banner = [];  
742 - break;  
743 - } 740 + banner = [];
  741 + break;
  742 + }
744 case 2: 743 case 2:
745 - { 744 + {
746 // TODO:单品店显示新版的店铺banner,item.php 210 745 // TODO:单品店显示新版的店铺banner,item.php 210
747 - let basisData = shopAPI.basisTemplateAsync(domainBrand.shopId); 746 + let basisData = shopAPI.basisTemplateAsync(domainBrand.shopId);
748 747
749 - banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;  
750 - break;  
751 - } 748 + banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
  749 + break;
  750 + }
752 751
753 } 752 }
754 } 753 }
@@ -823,15 +822,15 @@ function getDescriptionDataBySizeInfo(sizeInfo) { @@ -823,15 +822,15 @@ function getDescriptionDataBySizeInfo(sizeInfo) {
823 822
824 switch (sizeInfo.productDescBo.gender) { 823 switch (sizeInfo.productDescBo.gender) {
825 case 1: 824 case 1:
826 - {  
827 - sex = '男款';  
828 - break;  
829 - } 825 + {
  826 + sex = '男款';
  827 + break;
  828 + }
830 case 2: 829 case 2:
831 - {  
832 - sex = '女款';  
833 - break;  
834 - } 830 + {
  831 + sex = '女款';
  832 + break;
  833 + }
835 } 834 }
836 835
837 description.basic = []; 836 description.basic = [];
@@ -1192,25 +1191,25 @@ function getSizeAttrByMaxSortId(maxSortId, sizeList) { @@ -1192,25 +1191,25 @@ function getSizeAttrByMaxSortId(maxSortId, sizeList) {
1192 switch (maxSortId) { 1191 switch (maxSortId) {
1193 case 1: 1192 case 1:
1194 case 2: 1193 case 2:
1195 - {  
1196 - attributeIds = [3, 4];  
1197 - break;  
1198 - } 1194 + {
  1195 + attributeIds = [3, 4];
  1196 + break;
  1197 + }
1199 1198
1200 case 3: 1199 case 3:
1201 - {  
1202 - attributeIds = [6, 10];  
1203 - break;  
1204 - } 1200 + {
  1201 + attributeIds = [6, 10];
  1202 + break;
  1203 + }
1205 case 6: 1204 case 6:
1206 - {  
1207 - attributeIds = [13];  
1208 - break;  
1209 - } 1205 + {
  1206 + attributeIds = [13];
  1207 + break;
  1208 + }
1210 default: 1209 default:
1211 - {  
1212 - attributeIds = [];  
1213 - } 1210 + {
  1211 + attributeIds = [];
  1212 + }
1214 } 1213 }
1215 1214
1216 let sizeInfos = []; 1215 let sizeInfos = [];
@@ -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
@@ -1343,8 +1343,8 @@ module.exports.showMainAsync = (data) => { @@ -1343,8 +1343,8 @@ module.exports.showMainAsync = (data) => {
1343 result.productDetailPage = true; 1343 result.productDetailPage = true;
1344 result.detail = Object.assign(productInfo, sizeInfo); 1344 result.detail = Object.assign(productInfo, sizeInfo);
1345 result.statGoodsInfo = Object.assign({ 1345 result.statGoodsInfo = Object.assign({
1346 - fullSortName: navs.map(x => x.name).join('-')  
1347 - }, 1346 + fullSortName: navs.map(x => x.name).join('-')
  1347 + },
1348 productInfo.statGoodsInfo 1348 productInfo.statGoodsInfo
1349 ); 1349 );
1350 1350
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 {