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 = ' ';
... ... @@ -435,41 +434,41 @@ const getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => {
// 显示获取限购码按钮
switch (showStatus) {
case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码)
{
if (isBeginSale) {
{
if (isBeginSale) {
result.buyNow = true;
result.dis = true;
} else {
result.openSoon = true;
result.hasLimitedCode = false;
}
break;
}
case 2: // 开售后,限购码已抢光(用户未领取限购码)
{
result.buyNow = true;
result.dis = true;
} else {
result.openSoon = true;
result.limitedCodeSoldOut = true;
result.getLimitedCode = false;
result.hasLimitedCode = false;
break;
}
break;
}
case 2: // 开售后,限购码已抢光(用户未领取限购码)
{
result.buyNow = true;
result.dis = true;
result.limitedCodeSoldOut = true;
result.getLimitedCode = false;
result.hasLimitedCode = false;
break;
}
case 3: // 开售后,商品已经售罄
{
result.soldOut = true;
result.getLimitedCode = false;
break;
}
{
result.soldOut = true;
result.getLimitedCode = false;
break;
}
case 4:// 开售后,立即购买(用户已领取限购码)
{
result.buyNow = true;
result.dis = false;
result.hasLimitedCode = true;
if (uid) { // 限购码失效
result.getLimitedCodeDis = true;
{
result.buyNow = true;
result.dis = false;
result.hasLimitedCode = true;
if (uid) { // 限购码失效
result.getLimitedCodeDis = true;
}
break;
}
break;
}
case 5: // 开售前,限购码已被抢光(用户未领取限购码)
result.openSoon = true;
result.hasLimitedCode = true;
... ... @@ -736,19 +735,19 @@ const detailDataPkg = (origin, uid, vipLevel) => {
if (domainBrand.type && domainBrand.shopId) {
switch (parseInt(domainBrand.type)) {
case 1:
{
{
// 多品店不显示
banner = [];
break;
}
banner = [];
break;
}
case 2:
{
{
// TODO:单品店显示新版的店铺banner,item.php 210
let basisData = shopAPI.basisTemplateAsync(domainBrand.shopId);
let basisData = shopAPI.basisTemplateAsync(domainBrand.shopId);
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
break;
}
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
break;
}
}
}
... ... @@ -823,15 +822,15 @@ function getDescriptionDataBySizeInfo(sizeInfo) {
switch (sizeInfo.productDescBo.gender) {
case 1:
{
sex = '男款';
break;
}
{
sex = '男款';
break;
}
case 2:
{
sex = '女款';
break;
}
{
sex = '女款';
break;
}
}
description.basic = [];
... ... @@ -1192,25 +1191,25 @@ function getSizeAttrByMaxSortId(maxSortId, sizeList) {
switch (maxSortId) {
case 1:
case 2:
{
attributeIds = [3, 4];
break;
}
{
attributeIds = [3, 4];
break;
}
case 3:
{
attributeIds = [6, 10];
break;
}
{
attributeIds = [6, 10];
break;
}
case 6:
{
attributeIds = [13];
break;
}
{
attributeIds = [13];
break;
}
default:
{
attributeIds = [];
}
{
attributeIds = [];
}
}
let sizeInfos = [];
... ... @@ -1281,7 +1280,8 @@ const getSizeInfo = (productSkn, maxSortId)=> {
// 模特数据
let reference = getReferenceDataBySizeInfo(sizeInfo);
if(_.isEmpty(reference)){
if (_.isEmpty(reference)) {
result.reference = reference;
}
... ... @@ -1343,8 +1343,8 @@ module.exports.showMainAsync = (data) => {
result.productDetailPage = true;
result.detail = Object.assign(productInfo, sizeInfo);
result.statGoodsInfo = Object.assign({
fullSortName: navs.map(x => x.name).join('-')
},
fullSortName: navs.map(x => x.name).join('-')
},
productInfo.statGoodsInfo
);
... ...
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 {
... ...