...
|
...
|
@@ -91,12 +91,20 @@ const getPlatForm = (req) => { |
|
|
let userAgent = req.get('User-Agent');
|
|
|
let yoho = {};
|
|
|
let uids = req.get('User-Agent').match(/uid=([^;]+)/i);
|
|
|
let arrs = [];
|
|
|
let version = false;
|
|
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
|
|
|
|
yoho.isiOS = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(userAgent);
|
|
|
yoho.isAndroid = /Android/i.test(userAgent);
|
|
|
yoho.isApp = /YohoBuy/i.test(req.get('User-Agent')) || (req.query.app_version && req.query.client_type);
|
|
|
yoho.isSupportStudent = !yoho.isApp || (/^4.9/i.test(req.query.app_version) && !/^4.9.0/i.test(req.query.app_version));
|
|
|
if (req.query.app_version) {
|
|
|
arrs = req.query.app_version.split('.');
|
|
|
version = arrs.length > 2 && Number(arrs.slice(0, 2).join('') + arrs[2].slice(0, 1)) > 490;
|
|
|
}
|
|
|
|
|
|
|
|
|
yoho.isSupportStudent = !yoho.isApp || version;
|
|
|
yoho.http = 'http:';
|
|
|
if (isProduction) {
|
|
|
yoho.http = 'https:';
|
...
|
...
|
@@ -252,7 +260,8 @@ exports.index = (req, res, next) => { |
|
|
options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register"}}';
|
|
|
}
|
|
|
} else {
|
|
|
options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student"}}}';
|
|
|
// no login
|
|
|
options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register"}}}';
|
|
|
}
|
|
|
} else {
|
|
|
if (options.isLogin) {
|
...
|
...
|
@@ -287,14 +296,9 @@ exports.register = (req, res, next) => { |
|
|
}
|
|
|
Promise.all([verifiedStudentTotal(), getEducationLevelList()]).then((arr) => {
|
|
|
if (req.__USER__.isStudent) {
|
|
|
refer = req.get('referer') || '/home?openby:yohobuy={"action":"go.mine"}';// TODO
|
|
|
|
|
|
// if (refer) {
|
|
|
// refer = decodeURI(req.cookies.refer);
|
|
|
// } else {
|
|
|
// refer = '/activity/student';
|
|
|
// }
|
|
|
// refer = refer;
|
|
|
refer = '/activity/student';// 所有认证过的,都跳转学生首页
|
|
|
|
|
|
|
|
|
res.redirect(helpers.urlFormat(refer));
|
|
|
} else {
|
|
|
res.render('register', {
|
...
|
...
|
|