Authored by weiqingting

4.9.1 -> feature_student

... ... @@ -149,7 +149,6 @@ exports.index = (req, res, next) => {
banner,
icons,
link,
// url,
// param,
couponids = [];
... ... @@ -172,7 +171,7 @@ exports.index = (req, res, next) => {
link = item;
break;
default:
// other = item;
// other = item;
break;
}
});
... ... @@ -181,6 +180,10 @@ exports.index = (req, res, next) => {
coupons.data = (coupons.data || []).map((item) => {
couponids.push(item.couponID);
if (!req.__USER__.isLogin) {
item.image.url = 'http://m.yohobuy.com/activity/student/register?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http://m.yohobuy.com/activity/student"}}}';
}
// if (item.image.url.indexOf('?') === -1) {
// item.image.url += '?';
// }
... ... @@ -318,14 +321,14 @@ exports.school = (req, res, next) => {
};
exports.verifyidentity = (req, res, next) => {
// let uid=req.user.id;
// let uid=req.user.id;
let params = req.body;
let url = 'http://m.yohobuy.com/activity/student/verify?' +
queryString.stringify({
college_name: params.college_name,
education_degree: params.education_degree,
enrollment_year: params.enrollment_year
}) + '&';
queryString.stringify({
college_name: params.college_name,
education_degree: params.education_degree,
enrollment_year: params.enrollment_year
}) + '&';
let uid = req.__USER__.uid;
... ... @@ -340,38 +343,38 @@ exports.verifystudent = (req, res, next) => {
let uid = req.__USER__.uid;
Promise.all([verifiedStudentTotal(), vip(), verifyStudent(uid, params.college_name, params.education_degree, params.enrollment_year, params.token)])
.then((datas) => {
let isverify = false,
prompt = '你的学校信息未通审核';
if (datas[2].code === 200) {
if (datas[2].data.isStudent === 1) {
isverify = true;
prompt = datas[2].data.prompt;
.then((datas) => {
let isverify = false,
prompt = '你的学校信息未通审核';
if (datas[2].code === 200) {
if (datas[2].data.isStudent === 1) {
isverify = true;
prompt = datas[2].data.prompt;
}
} else {
prompt = datas[2].message;
}
} else {
prompt = datas[2].message;
}
datas[1].data.product_list = datas[1].data.product_list.map(function(value) {
value.goodsId = value.goods_list[0].goods_id;
value.url = helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`;
return value;
});
return getUser(uid).then((user) => {
res.render('verify', {
isApp: req.__USER__.isApp,
count: datas[0].data,
goods: datas[1].data.product_list,
isverify: isverify,
prompt: prompt,
isLogin: user.data && user.data.vip_info && user.data.vip_info.is_student ? true : false,
title: '学生身份认证',
http: req.__USER__.http,
uid: req.__USER__.uid
datas[1].data.product_list = datas[1].data.product_list.map(function(value) {
value.goodsId = value.goods_list[0].goods_id;
value.url = helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`;
return value;
});
}).catch(next);
return getUser(uid).then((user) => {
res.render('verify', {
isApp: req.__USER__.isApp,
count: datas[0].data,
goods: datas[1].data.product_list,
isverify: isverify,
prompt: prompt,
isLogin: user.data && user.data.vip_info && user.data.vip_info.is_student ? true : false,
title: '学生身份认证',
http: req.__USER__.http,
uid: req.__USER__.uid
});
}).catch(next);
}).catch(next);
}).catch(next);
};
exports.detail = (req, res) => {
... ... @@ -415,7 +418,7 @@ exports.isLogin = (req, res, next) => {
res.redirect(helpers.urlFormat('/signin.html', {
refer: req.get('referer') || '/activity/student/register'
}));
});
}).catch(next);
};
... ... @@ -424,7 +427,5 @@ exports.getUser = (req, res, next)=>{
getPlatForm(req).then((yoho)=>{
req.__USER__ = yoho;
next();
});
}).catch(next);
};
... ...