Authored by 周少峰

add is students

... ... @@ -80,6 +80,7 @@ const Auth = {
if (data) {
let uidCookie = `{data.profile_name}::${encryptionUid}::${data.vip_info.title}::${token}`;
let isStudent = data.vip_info.is_student || 0;
req.session._TOKEN = token;
req.session._LOGIN_UID = uid;
... ... @@ -87,6 +88,9 @@ const Auth = {
res.cookie('_UID', uidCookie, {
domain: 'yohobuy.com'
});
res.cookie('isStudent', isStudent, {
domain: 'yohobuy.com'
});
}
req.session._TOKEN = token; // esline-disable-line
req.session._LOGIN_UID = uid; // esline-disable-line
... ...
... ... @@ -36,6 +36,7 @@ class DetailAction extends YohoAction {
channel: this.getSessionChannel(),
gender: this.guessUserGender(),
uid: uid,
isStudent: req.user.isStudent,
vipLevel: vipLevel
}).then(result=> {
const seo = result.seo;
... ...
... ... @@ -51,7 +51,7 @@ const getProductModelTryAsync = skn => {
* @param pid
* @returns {Promise.<type>}
*/
const getProductAsync = (pid, uid) => {
const getProductAsync = (pid, uid, isStudents, vipLevel) => {
let params = {
method: 'h5.product.data',
productId: pid
... ...
... ... @@ -1366,7 +1366,7 @@ const showMainAsync = (data) => {
let currentUserProductInfo = _.curry(_detailDataPkg)(_, data.uid, data.vipLevel);
// 获取商品信息
let productInfo = yield productAPI.getProductAsync(data.pid, data.uid).then(currentUserProductInfo);
let productInfo = yield productAPI.getProductAsync(data.pid, data.uid, data.isStudent, data.vipLevel).then(currentUserProductInfo);
if (!productInfo || _.isEmpty(productInfo)) {
return Promise.reject({
... ...
... ... @@ -23,6 +23,11 @@ module.exports = () => {
req.user.vip = getVip(req.cookies._UID);
}
// 用户是否学生
if (req.user.uid && req.cookies.isStudent) {
req.user.isStudent = req.cookies.isStudent;
}
next();
};
};
... ...