Authored by htoooth

remove fake data

... ... @@ -124,7 +124,7 @@ module.exports.createConsult = (req, res, next) => {
code: 403,
message: '用户没有登录',
data: {
url: helpers.urlFormat('signin.html')
url: helpers.urlFormat('/signin.html')
}
});
... ...
... ... @@ -6,24 +6,19 @@ const sign = require(`${library}/sign`);
const api = new API();
const fake = require('./fake');
module.exports.getBannerInfoAsync = (bid) => {
//return api.get('', sign.apiSign({
// method: 'web.brand.banner',
// brand_id: bid
//}));
return api.get('', sign.apiSign({
method: 'web.brand.banner',
brand_id: bid
}));
return Promise.resolve(fake.fakeBrandBanner);
};
module.exports.getBrandLogoByDomainAsync = (domain) => {
//return api.get('', sign.apiSign({
// domain: domain,
// method: 'web.brand.byDomain'
//}));
return Promise.resolve(fake.fakeBrandDomain);
return api.get('', sign.apiSign({
domain: domain,
method: 'web.brand.byDomain'
}));
};
... ...
... ... @@ -15,38 +15,36 @@ const api = require('./detail-comment-api');
const detailHelper = require('./detail-helper');
const fake = require('./fake');
module.exports.indexAsync = (pid, page, size) => {
return co(function *() {
return fake.fakeComments;
//let commentList = yield api.indexAsync(pid, page, size);
//
//if (!commentList.code || !commentList.code !== 200) {
// return [];
//}
//return commentList.data.map(value => {
// let item = {};
//
// let avatar = detailHelper.DEFAULT_AVATAR_ICO;
//
// if (value.head_ico) {
// avatar = `${detailHelper.IMAGE_SERVICE_URL}${_.last(value.head_ico.split('headimg'))}`;
// avatar = helpers.image(avatar, 30, 30);
// }
//
// item.avatar = avatar;
// item.userName = value.nickname;
// item.color = value.color_name;
// item.size = value.size_name;
// item.comment = value.content || '';
// item.date = value.create_time;
// item.total = value.total;
//
// return item;
//});
let commentList = yield api.indexAsync(pid, page, size);
if (!commentList.code || !commentList.code !== 200) {
return [];
}
return commentList.data.map(value => {
let item = {};
let avatar = detailHelper.DEFAULT_AVATAR_ICO;
if (value.head_ico) {
avatar = `${detailHelper.IMAGE_SERVICE_URL}${_.last(value.head_ico.split('headimg'))}`;
avatar = helpers.image(avatar, 30, 30);
}
item.avatar = avatar;
item.userName = value.nickname;
item.color = value.color_name;
item.size = value.size_name;
item.comment = value.content || '';
item.date = value.create_time;
item.total = value.total;
return item;
});
})();
};
... ...
... ... @@ -10,33 +10,29 @@ const co = Promise.coroutine;
const api = require('./detail-consult-api');
const detailHelper = require('./detail-helper');
const fake = require('./fake');
module.exports.indexAsync = (uid, pid, page, size) => {
return co(function *() {
return fake.fakeConsule;
//let consultList = yield api.indexAsync(uid, pid, page, size);
//
//if (!consultList.code || consultList.code !== 200) {
// return [];
//}
//
//return consultList.data.list.map(value => {
// return {
// avatar: detailHelper.DEFAULT_AVATAR_ICO,
// question: value.ask,
// date: value.ask_time,
// answer: value.answer,
// id: value.id,
// isLike: value.is_like === 'Y',
// like: parseInt(value.like, 10),
// isUseful: value.is_useful === 'Y',
// useful: parseInt(value.useful, 10),
// total: value.total
// };
//});
let consultList = yield api.indexAsync(uid, pid, page, size);
if (!consultList.code || consultList.code !== 200) {
return [];
}
return consultList.data.list.map(value => {
return {
avatar: detailHelper.DEFAULT_AVATAR_ICO,
question: value.ask,
date: value.ask_time,
answer: value.answer,
id: value.id,
isLike: value.is_like === 'Y',
like: parseInt(value.like, 10),
isUseful: value.is_useful === 'Y',
useful: parseInt(value.useful, 10),
total: value.total
};
});
})();
};
... ...
... ... @@ -9,15 +9,12 @@ const log = require(`${library}/logger`);
const api = new API();
const fake = require('./fake');
/**
* 获取商品的热区
*/
module.exports.indexAsync = (pid) => {
//return api.get('', sign.apiSign({
// method: 'web.productCollocation.list',
// product_id: pid
//})).catch(log.error);
return Promise.resolve(fake.fakeProductCollent);
return api.get('', sign.apiSign({
method: 'web.productCollocation.list',
product_id: pid
})).catch(log.error);
};
... ...
... ... @@ -8,53 +8,45 @@ const log = require(`${library}/logger`);
const api = new API();
const fake = require('./fake');
module.exports.getProductBannerAsync = function(pid, clientType) {
//clientType = clientType || 'web';
//return api.get('', sign.apiSign({
// method: 'web.productBanner.data',
// product_id: pid,
// client_type: clientType
//})).catch(log.error);
return Promise.resolve(fake.fakeProductBanner);
clientType = clientType || 'web';
return api.get('', sign.apiSign({
method: 'web.productBanner.data',
product_id: pid,
client_type: clientType
})).catch(log.error);
};
module.exports.sizeInfoAsync = function(skn) {
//return api.get('', sign.apiSign({
// method: 'h5.product.intro',
// productskn: skn
//})).catch(log.error);
return api.get('', sign.apiSign({
method: 'h5.product.intro',
productskn: skn
})).catch(log.error);
return Promise.resolve(fake.fakeProductIntro);
};
module.exports.getProductComfortAsync = function(pid) {
//return api.get('', sign.apiSign({
// method: 'web.productComfort.data',
// product_id: pid
//})).catch(log.error);
return api.get('', sign.apiSign({
method: 'web.productComfort.data',
product_id: pid
})).catch(log.error);
return Promise.resolve(fake.fakeComfort);
};
module.exports.getProductModelCardAsync = function(pid) {
//return api.get('', sign.apiSign({
// method: 'web.productModelcard.list',
// product_id: pid
//})).catch(log.error);
return Promise.resolve(fake.fakeModelCard);
return api.get('', sign.apiSign({
method: 'web.productModelcard.list',
product_id: pid
})).catch(log.error);
};
module.exports.getProductModelTryAsync = function(skn) {
//return api.get('', sign.apiSign({
// method: 'web.productModelTry.data',
// product_skn: skn
//})).catch(log.error);
return Promise.resolve(fake.fakeModelTry);
return api.get('', sign.apiSign({
method: 'web.productModelTry.data',
product_skn: skn
})).catch(log.error);
};
/**
... ... @@ -63,12 +55,10 @@ module.exports.getProductModelTryAsync = function(skn) {
* @returns {Promise.<type>}
*/
module.exports.getProductInfo = function(pid) {
//return api.get('', sign.apiSign({
// method: 'h5.product.data',
// productId: pid
//})).catch(console.log);
return Promise.resolve(fake.fakeProduct);
return api.get('', sign.apiSign({
method: 'h5.product.data',
productId: pid
})).catch(console.log);
};
... ...
... ... @@ -27,7 +27,6 @@ const shopAPI = require('./shop-api');
const searchAPI = require('./search-api');
const homeService = require('./home-service');
const HeaderModel = require('../../../doraemon/models/header');
const fake = require('./fake');
const BLANK_STR = ' ';
... ... @@ -1281,7 +1280,8 @@ const getSizeInfo = (productSkn, maxSortId)=> {
// 模特数据
let reference = getReferenceDataBySizeInfo(sizeInfo);
if(_.isEmpty(reference)){
if (_.isEmpty(reference)) {
result.reference = reference;
}
... ...
This diff could not be displayed because it is too large.
... ... @@ -6,11 +6,7 @@ const log = require(`${library}/logger`);
const api = new API();
const fake = require('./fake');
module.exports.getSortByConditionAsync = function(condition) {
//return api.get('sortgroup.json', condition).catch(log.error);
return Promise.resolve(fake.fakeNav);
return api.get('sortgroup.json', condition).catch(log.error);
};
... ...
... ... @@ -15,9 +15,6 @@ const serviceApi = new ServiceAPI();
const log = require(`${global.library}/logger`);
const Promise = require('bluebird');
const fake = require('../../apps/product/models/fake');
/**
* 获取菜单
* @param undefined
... ... @@ -204,17 +201,7 @@ exports.requestHeaderData = (type, parentId) => {
type = type || 'boys';
//return serviceApi.get('operations/api/v6/category/getCategory', data, true).then(res => {
// if (res && res.code === 200) {
// return setHeaderData(res.data, type);
// } else {
// log.error('获取头部信息的接口返回状态码 不是 200');
// return {};
// }
//});
return Promise.resolve(fake.fakeHeader).then(res => {
console.log(res);
return serviceApi.get('operations/api/v6/category/getCategory', data, true).then(res => {
if (res && res.code === 200) {
return setHeaderData(res.data, type);
} else {
... ...