...
|
...
|
@@ -11,11 +11,13 @@ const _ = require('lodash'); |
|
|
const productProcess = require(`${utils}/product-process`);
|
|
|
|
|
|
const userAcquireStatus = (uid, couponIds) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.coupons.userAcquireStatus',
|
|
|
uid: uid,
|
|
|
couponIds: couponIds
|
|
|
});
|
|
|
if (couponIds != '') {
|
|
|
return api.get('', {
|
|
|
method: 'app.coupons.userAcquireStatus',
|
|
|
uid: uid,
|
|
|
couponIds: couponIds
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -24,35 +26,36 @@ const userAcquireStatus = (uid, couponIds) => { |
|
|
* @returns {*}
|
|
|
*/
|
|
|
const _getRelatedData = (idList) => {
|
|
|
return api.get('', {
|
|
|
productSkn: idList,
|
|
|
method: 'h5.product.batch'
|
|
|
}).then((result) => {
|
|
|
if (idList != '') {
|
|
|
return api.get('', {
|
|
|
productSkn: idList,
|
|
|
method: 'h5.product.batch'
|
|
|
}).then((result) => {
|
|
|
|
|
|
let goods = [],
|
|
|
productList = [];
|
|
|
let goods = [],
|
|
|
productList = [];
|
|
|
|
|
|
if (result && result.data.product_list && result.code === 200) {
|
|
|
if (result && result.data && result.data.product_list && result.code === 200) {
|
|
|
|
|
|
_.forEach(result.data.product_list, function(val) {
|
|
|
_.forEach(result.data.product_list, function(val) {
|
|
|
|
|
|
if (val.student_price) {
|
|
|
productList.push(val);
|
|
|
}
|
|
|
});
|
|
|
if (val.student_price) {
|
|
|
productList.push(val);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
goods = productProcess.processProductList(productList);
|
|
|
goods = productProcess.processProductList(productList);
|
|
|
|
|
|
return goods;
|
|
|
} else {
|
|
|
logger.error('推荐商品 cood 不是 200');
|
|
|
return {};
|
|
|
}
|
|
|
});
|
|
|
return goods;
|
|
|
} else {
|
|
|
return {};
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
exports.index = (req, res, next) => {
|
|
|
let code = '50b995e190ff8cfe52989972a4943b06';
|
|
|
let code = 'c9b9639ce2884b768cfbc5cf9e68a53f';
|
|
|
let uid = req.__USER__.uid;
|
|
|
let options;
|
|
|
let noLoginUrl = helpers.urlFormat('/activity/student/register') + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student-market"}}}';
|
...
|
...
|
@@ -62,7 +65,7 @@ exports.index = (req, res, next) => { |
|
|
platform: 'iphone'
|
|
|
}).then((result) => {
|
|
|
|
|
|
let coupons,
|
|
|
let coupons = {},
|
|
|
activities,
|
|
|
banner,
|
|
|
icons,
|
...
|
...
|
@@ -171,24 +174,13 @@ exports.index = (req, res, next) => { |
|
|
options.loginUrl = '//m.yohobuy.com/activity/student/register';
|
|
|
if (options.isApp) {
|
|
|
if (options.isLogin) {
|
|
|
if (options.isStudent) {
|
|
|
// options.loginUrl = false;
|
|
|
} else {
|
|
|
options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register"}}';
|
|
|
}
|
|
|
options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register"}}';
|
|
|
} else {
|
|
|
// no login
|
|
|
options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register","antarget":"1"}}}';
|
|
|
}
|
|
|
} else {
|
|
|
if (options.isLogin) {
|
|
|
if (options.isStudent) {
|
|
|
// options.loginUrl = false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// console.log(options);
|
|
|
res.render('student-market', options);
|
|
|
|
|
|
}).catch(next);
|
...
|
...
|
|