...
|
...
|
@@ -8,37 +8,43 @@ const Promise = require('bluebird'); |
|
|
const co = Promise.coroutine;
|
|
|
const helpers = global.yoho.helpers;
|
|
|
|
|
|
const FavoriteModel=require('../models/FavoriteModel');
|
|
|
const favoriteService = require('../models/favorite-service');
|
|
|
|
|
|
const index=(req, res, next)=>{
|
|
|
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);
|
|
|
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 = favoriteService.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;
|
|
|
switch (type) {
|
|
|
case 'brand':
|
|
|
data.favBrands = yield favoriteService.favoriteBrandList(uid, page, limit, type);
|
|
|
break;
|
|
|
case 'article':
|
|
|
data.favArticles = yield favoriteService.favoriteArticleList(uid, udid, page, limit, type);
|
|
|
break;
|
|
|
default:
|
|
|
data.favProducts = yield favoriteService.favoriteProductList(uid, page, limit, type, sort, 'N', reduction, promotion);
|
|
|
break;
|
|
|
}
|
|
|
console.log(data);
|
|
|
res.render("favorite",{
|
|
|
meFavoritePage:true,
|
|
|
meFavorite:data
|
|
|
res.render("favorite", {
|
|
|
meFavoritePage: true,
|
|
|
meFavorite: data
|
|
|
});
|
|
|
})();
|
|
|
}
|
|
|
|
|
|
const reductionAction=()=>{
|
|
|
const reductionAction = ()=> {
|
|
|
|
|
|
}
|
|
|
|
|
|
module.exports ={
|
|
|
module.exports = {
|
|
|
index
|
|
|
} |
...
|
...
|
|