Authored by 郭成尧

全频道基础框架调整

... ... @@ -10,9 +10,7 @@ const headerModel = require('../../../doraemon/models/header');
const mRoot = '../models';
// sale 页 model
// const sale = require(`${mRoot}/sale`);
// const saleDiscount = require(`${mRoot}/sale-discount`);
const sale = require(`${mRoot}/sale`);
// 开发用模拟数据
const simulation = require(`${mRoot}/simulation`);
... ... @@ -67,15 +65,15 @@ exports.discount = (req, res) => {
response.devEnv = true;
// 假数据输出
res.render('sale/discount', Object.assign(response, simulation.discount()));
// res.render('sale/discount', Object.assign(response, simulation.discount()));
/* return saleDiscount.getSaleDiscountData()
return sale.getSaleGoodsListData()
.then(result => {
response.result = result;
response.resultShow = JSON.stringify(result, null, 4);
res.render('sale/discount', response);
});*/
});
})
.catch(() => {
... ... @@ -101,7 +99,7 @@ exports.vip = (req, res) => {
// 假数据输出
res.render('sale/other', Object.assign(response, simulation.other()));
/* return saleVip.getSaleVipData()
/* return sale.getSaleGoodsListData()
.then(result => {
response.result = result;
response.resultShow = JSON.stringify(result, null, 4);
... ... @@ -133,7 +131,7 @@ exports.breakingYards = (req, res) => {
// 假数据输出
res.render('sale/other', Object.assign(response, simulation.other()));
/* return breakingYards.getSaleBreakingYardsData()
/* return sale.getSaleGoodsListData()
.then(result => {
response.result = result;
response.resultShow = JSON.stringify(result, null, 4);
... ... @@ -165,7 +163,7 @@ exports.newSale = (req, res) => {
// 假数据输出
res.render('sale/other', Object.assign(response, simulation.other()));
/* return newSale.getSaleNewSaleData()
/* return sale.getSaleNewSaleData()
.then(result => {
response.result = result;
response.resultShow = JSON.stringify(result, null, 4);
... ...
/*
* @Author: Targaryen
* @Date: 2016-05-19 16:10:11
* @Last Modified by: Targaryen
* @Last Modified time: 2016-05-19 16:16:55
*/
'use strict';
const library = '../../../library';
const API = require(`${library}/api`).API;
const sign = require(`${library}/sign`);
const api = new API();
/**
* 处理商品列表数据
* @param {[type]} origin [description]
* @return {[type]} [description]
*/
const handleSaleDiscountData = (origin) => {
var dest = {};
dest = origin;
return dest;
};
/**
* 获取商品列表数据
* @return {[type]} [description]
*/
exports.getSaleDiscountData = () => {
return api.get('', sign.apiSign({
method: 'app.search.sales',
limit: 20,
order: 's_t_desc',
page: 1,
productSize: '384x511',
yh_channel: 1
})).then(result => {
return handleSaleDiscountData(result);
});
};
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-05-19 10:20:08
* @Last Modified by: Targaryen
* @Last Modified time: 2016-05-19 16:49:04
* @Last Modified time: 2016-05-19 17:27:36
*/
'use strict';
... ... @@ -24,6 +24,19 @@ const handleSaleData = (origin) => {
};
/**
* 处理商品列表数据
* @param {[type]} origin [description]
* @return {[type]} [description]
*/
const handleSaleGoodsListData = (origin) => {
var dest = {};
dest = origin;
return dest;
};
/**
* 获取首页数据
* @return {[type]} [description]
*/
... ... @@ -37,3 +50,22 @@ exports.getSaleDate = () => {
return handleSaleData(result);
});
};
/**
* 获取商品列表数据
* @return {[type]} [description]
*/
exports.getSaleGoodsListData = () => {
return api.get('', sign.apiSign({
method: 'app.search.sales',
limit: 20,
order: 's_t_desc',
page: 1,
productSize: '384x511',
yh_channel: 1
})).then(result => {
return handleSaleGoodsListData(result);
});
};
... ...