...
|
...
|
@@ -7,6 +7,7 @@ const queryString = require('querystring'); |
|
|
const Promise = require('bluebird');
|
|
|
const co = Promise.coroutine;
|
|
|
const headerModel = require('../../../doraemon/models/header'); // 头部model
|
|
|
const _=require('lodash');
|
|
|
|
|
|
|
|
|
const getResource = code => {
|
...
|
...
|
@@ -91,6 +92,7 @@ const getPlatForm = (req) => { |
|
|
let userAgent = req.get('User-Agent');
|
|
|
let yoho = {};
|
|
|
let uids = req.get('User-Agent').match(/uid=([^;]+)/i);
|
|
|
let versions = req.get('User-Agent').match(/app_version=([^;]+)/i);
|
|
|
let arrs = [];
|
|
|
let isNewVersion = false;
|
|
|
const isProduction = process.env.NODE_ENV === 'production';
|
...
|
...
|
@@ -98,8 +100,13 @@ const getPlatForm = (req) => { |
|
|
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.app_version = req.query.app_version || '';
|
|
|
|
|
|
yoho.app_version = versions && versions.length === 2 ? versions[1] : '';
|
|
|
yoho.app_version = yoho.app_version || req.query.app_version || '';
|
|
|
console.log("yoho.app_version");
|
|
|
console.log(yoho.app_version);
|
|
|
if (yoho.app_version) {
|
|
|
yoho.app_version=_.toString(yoho.app_version);
|
|
|
arrs = yoho.app_version.split('.');
|
|
|
if (arrs.length > 2) {
|
|
|
if (arrs[0] && +arrs[0] < 4) {
|
...
|
...
|
@@ -126,6 +133,7 @@ const getPlatForm = (req) => { |
|
|
let data = yield getUser(yoho.uid);
|
|
|
|
|
|
yoho.isStudent = data.data && data.data.vip_info && data.data.vip_info.is_student ? true : false;
|
|
|
|
|
|
// yoho.isStudent = false;
|
|
|
return yoho;
|
|
|
})();
|
...
|
...
|
@@ -233,7 +241,8 @@ exports.index = (req, res, next) => { |
|
|
title: '有货学生专享优惠',
|
|
|
http: req.__USER__.http,
|
|
|
uid: req.__USER__.uid,
|
|
|
app_version: req.__USER__.app_version
|
|
|
app_version: req.__USER__.app_version,
|
|
|
isAppNoLogin: req.__USER__.isApp && !req.__USER__.isLogin
|
|
|
};
|
|
|
if (!req.__USER__.isApp) {
|
|
|
options.pageHeader = headerModel.setNav({
|
...
|
...
|
@@ -341,7 +350,7 @@ exports.verifystudent = (req, res, next) => { |
|
|
Promise.all([verifiedStudentTotal(), vip(), verifyStudent(uid, params.college_name, params.education_degree, params.enrollment_year, params.token)])
|
|
|
.then((datas) => {
|
|
|
let isverify = false,
|
|
|
prompt = '你的学校信息未通审核';
|
|
|
prompt = '您的学校信息未通审核';
|
|
|
|
|
|
if (datas[2].code === 200) {
|
|
|
if (datas[2].code === 200) {
|
...
|
...
|
|