Favorite.js
1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* 我的优惠券 controller
* @author: weiqingting<qingting.wei@yoho.cn>
* @date: 2016/05/16
*/
'use strict';
const Promise = require('bluebird');
const co = Promise.coroutine;
const helpers = global.yoho.helpers;
const FavoriteModel=require('../models/FavoriteModel');
const index=(req, res, next)=>{
let uid = '8041246';
let udid='8041246';
co(function*(){
let page=req.query.page||1;
let type=req.query.type||'article';
let sort=req.query.sort_id||0;
let reduction=req.query.is_reduction||'N';
let promotion=req.query.is_promotion||'N';
let limit=10,data={};
data.tabs= FavoriteModel.getFavoriteTabs(type);
switch(type){
case 'brand':data.favBrands=yield FavoriteModel.favoriteBrandList(uid,page,limit,type);break;
case 'article':data.favArticles=yield FavoriteModel.favoriteArticleList(uid,udid,page,limit,type);break;
default:data.favProducts= yield FavoriteModel.favoriteProductList(uid,page,limit,type,sort,'N',reduction,promotion);break;
}
console.log(data);
res.render("favorite",{
meFavoritePage:true,
meFavorite:data
});
})();
}
const reductionAction=()=>{
}
module.exports ={
index
}