Authored by weiqingting

4.9.1 -> feature_student

@@ -149,7 +149,6 @@ exports.index = (req, res, next) => { @@ -149,7 +149,6 @@ exports.index = (req, res, next) => {
149 banner, 149 banner,
150 icons, 150 icons,
151 link, 151 link,
152 -  
153 // url, 152 // url,
154 // param, 153 // param,
155 couponids = []; 154 couponids = [];
@@ -172,7 +171,7 @@ exports.index = (req, res, next) => { @@ -172,7 +171,7 @@ exports.index = (req, res, next) => {
172 link = item; 171 link = item;
173 break; 172 break;
174 default: 173 default:
175 - // other = item; 174 + // other = item;
176 break; 175 break;
177 } 176 }
178 }); 177 });
@@ -181,6 +180,10 @@ exports.index = (req, res, next) => { @@ -181,6 +180,10 @@ exports.index = (req, res, next) => {
181 coupons.data = (coupons.data || []).map((item) => { 180 coupons.data = (coupons.data || []).map((item) => {
182 couponids.push(item.couponID); 181 couponids.push(item.couponID);
183 182
  183 + if (!req.__USER__.isLogin) {
  184 + item.image.url = 'http://m.yohobuy.com/activity/student/register?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http://m.yohobuy.com/activity/student"}}}';
  185 + }
  186 +
184 // if (item.image.url.indexOf('?') === -1) { 187 // if (item.image.url.indexOf('?') === -1) {
185 // item.image.url += '?'; 188 // item.image.url += '?';
186 // } 189 // }
@@ -318,14 +321,14 @@ exports.school = (req, res, next) => { @@ -318,14 +321,14 @@ exports.school = (req, res, next) => {
318 }; 321 };
319 322
320 exports.verifyidentity = (req, res, next) => { 323 exports.verifyidentity = (req, res, next) => {
321 - // let uid=req.user.id; 324 + // let uid=req.user.id;
322 let params = req.body; 325 let params = req.body;
323 let url = 'http://m.yohobuy.com/activity/student/verify?' + 326 let url = 'http://m.yohobuy.com/activity/student/verify?' +
324 - queryString.stringify({  
325 - college_name: params.college_name,  
326 - education_degree: params.education_degree,  
327 - enrollment_year: params.enrollment_year  
328 - }) + '&'; 327 + queryString.stringify({
  328 + college_name: params.college_name,
  329 + education_degree: params.education_degree,
  330 + enrollment_year: params.enrollment_year
  331 + }) + '&';
329 332
330 let uid = req.__USER__.uid; 333 let uid = req.__USER__.uid;
331 334
@@ -340,38 +343,38 @@ exports.verifystudent = (req, res, next) => { @@ -340,38 +343,38 @@ exports.verifystudent = (req, res, next) => {
340 let uid = req.__USER__.uid; 343 let uid = req.__USER__.uid;
341 344
342 Promise.all([verifiedStudentTotal(), vip(), verifyStudent(uid, params.college_name, params.education_degree, params.enrollment_year, params.token)]) 345 Promise.all([verifiedStudentTotal(), vip(), verifyStudent(uid, params.college_name, params.education_degree, params.enrollment_year, params.token)])
343 - .then((datas) => {  
344 - let isverify = false,  
345 - prompt = '你的学校信息未通审核';  
346 -  
347 - if (datas[2].code === 200) {  
348 - if (datas[2].data.isStudent === 1) {  
349 - isverify = true;  
350 - prompt = datas[2].data.prompt; 346 + .then((datas) => {
  347 + let isverify = false,
  348 + prompt = '你的学校信息未通审核';
  349 +
  350 + if (datas[2].code === 200) {
  351 + if (datas[2].data.isStudent === 1) {
  352 + isverify = true;
  353 + prompt = datas[2].data.prompt;
  354 + }
  355 + } else {
  356 + prompt = datas[2].message;
351 } 357 }
352 - } else {  
353 - prompt = datas[2].message;  
354 - }  
355 - datas[1].data.product_list = datas[1].data.product_list.map(function(value) {  
356 - value.goodsId = value.goods_list[0].goods_id;  
357 - 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}}}`;  
358 - return value;  
359 - });  
360 - return getUser(uid).then((user) => {  
361 - res.render('verify', {  
362 - isApp: req.__USER__.isApp,  
363 - count: datas[0].data,  
364 - goods: datas[1].data.product_list,  
365 - isverify: isverify,  
366 - prompt: prompt,  
367 - isLogin: user.data && user.data.vip_info && user.data.vip_info.is_student ? true : false,  
368 - title: '学生身份认证',  
369 - http: req.__USER__.http,  
370 - uid: req.__USER__.uid 358 + datas[1].data.product_list = datas[1].data.product_list.map(function(value) {
  359 + value.goodsId = value.goods_list[0].goods_id;
  360 + 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}}}`;
  361 + return value;
371 }); 362 });
372 - }).catch(next); 363 + return getUser(uid).then((user) => {
  364 + res.render('verify', {
  365 + isApp: req.__USER__.isApp,
  366 + count: datas[0].data,
  367 + goods: datas[1].data.product_list,
  368 + isverify: isverify,
  369 + prompt: prompt,
  370 + isLogin: user.data && user.data.vip_info && user.data.vip_info.is_student ? true : false,
  371 + title: '学生身份认证',
  372 + http: req.__USER__.http,
  373 + uid: req.__USER__.uid
  374 + });
  375 + }).catch(next);
373 376
374 - }).catch(next); 377 + }).catch(next);
375 }; 378 };
376 379
377 exports.detail = (req, res) => { 380 exports.detail = (req, res) => {
@@ -415,7 +418,7 @@ exports.isLogin = (req, res, next) => { @@ -415,7 +418,7 @@ exports.isLogin = (req, res, next) => {
415 res.redirect(helpers.urlFormat('/signin.html', { 418 res.redirect(helpers.urlFormat('/signin.html', {
416 refer: req.get('referer') || '/activity/student/register' 419 refer: req.get('referer') || '/activity/student/register'
417 })); 420 }));
418 - }); 421 + }).catch(next);
419 422
420 423
421 }; 424 };
@@ -424,7 +427,5 @@ exports.getUser = (req, res, next)=>{ @@ -424,7 +427,5 @@ exports.getUser = (req, res, next)=>{
424 getPlatForm(req).then((yoho)=>{ 427 getPlatForm(req).then((yoho)=>{
425 req.__USER__ = yoho; 428 req.__USER__ = yoho;
426 next(); 429 next();
427 - });  
428 -  
429 - 430 + }).catch(next);
430 }; 431 };