recommend-for-you.js 1.42 KB
'use strict';

const mRoot = '../models';
const recommendForYouModel = require(`${mRoot}/recommend-for-you`); // 领取优惠券 model

exports.userCenter = (req, res, next) => {
    var udid = req.sessionID,
        uid = req.user.uid || 0,
        yhChannel = req.query.yh_channel || '1',
        limit = 30;

    recommendForYouModel.getPreference({
        yh_channel: yhChannel,
        udid: udid,
        limit: limit,
        rec_pos: '100004',
        uid: uid
    }).then((preferenceData) => {
        if (preferenceData.code === 200) {
            // 获取信息成功
        }
        res.render('recommend-for-you/index', {
            layout: false,
            result: preferenceData,
            module: 'product',
            page: 'recommend'
        });
    }).catch(next);
};

exports.cart = (req, res, next) => {
    var udid = req.sessionID,
        uid = req.user.uid || 0,
        yhChannel = req.query.yh_channel || '1',
        limit = 30;

    recommendForYouModel.getPreference({
        yh_channel: yhChannel,
        udid: udid,
        limit: limit,
        rec_pos: '100003',
        uid: uid
    }).then((preferenceData) => {

        if (preferenceData.code === 200) {
            // 获取信息成功
        }
        res.render('recommend-for-you/index', {
            layout: false,
            result: preferenceData,
            module: 'product',
            page: 'recommend'
        });
    }).catch(next);
};