...
|
...
|
@@ -20,28 +20,7 @@ const index = (req, res, next)=>{ |
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
// 个人中心-首页-喜欢的品牌
|
|
|
async function brands(req, res) {
|
|
|
let brandsData = await req.ctx(indexService).brands();
|
|
|
|
|
|
res.json({brands: brandsData, more: '/brands'});
|
|
|
}
|
|
|
|
|
|
// 新品上架
|
|
|
async function newArrive(req, res) {
|
|
|
let arrive = await req.ctx(indexService).newArrive();
|
|
|
|
|
|
res.json({newArrive: arrive});
|
|
|
}
|
|
|
|
|
|
// 推荐
|
|
|
async function recommend(req, res) {
|
|
|
let uid = req.user.uid;
|
|
|
let udid = req.user.uid + req.yoho.udid;
|
|
|
let channelNum = req.yoho.channelNum;
|
|
|
|
|
|
res.json({recommend: await req.ctx(indexService).recommend(uid, udid, channelNum)});
|
|
|
}
|
|
|
|
|
|
// 头像和左侧菜单我的消息
|
|
|
async function newsAvatar(req, res) {
|
...
|
...
|
@@ -51,19 +30,24 @@ async function newsAvatar(req, res) { |
|
|
res.json(result);
|
|
|
}
|
|
|
|
|
|
async function numbers(req, res) {
|
|
|
async function asyncData(req, res) {
|
|
|
let uid = req.user.uid;
|
|
|
let result = await req.ctx(indexService).numbers(uid);
|
|
|
let udid = req.user.uid + req.yoho.udid;
|
|
|
let channelNum = req.yoho.channelNum;
|
|
|
|
|
|
res.json(result);
|
|
|
let data = await Promise.props({
|
|
|
numbers: req.ctx(indexService).numbers(uid),
|
|
|
brands: req.ctx(indexService).brands(),
|
|
|
products: req.ctx(indexService).newArrive(),
|
|
|
rec: req.ctx(indexService).recommend(uid, udid, channelNum)
|
|
|
});
|
|
|
|
|
|
res.json(data);
|
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
|
index,
|
|
|
brands,
|
|
|
newArrive,
|
|
|
recommend,
|
|
|
newsAvatar,
|
|
|
numbers
|
|
|
asyncData
|
|
|
};
|
|
|
|
...
|
...
|
|