|
@@ -7,6 +7,7 @@ const queryString = require('querystring'); |
|
@@ -7,6 +7,7 @@ const queryString = require('querystring'); |
7
|
const Promise = require('bluebird');
|
7
|
const Promise = require('bluebird');
|
8
|
const co = Promise.coroutine;
|
8
|
const co = Promise.coroutine;
|
9
|
const headerModel = require('../../../doraemon/models/header'); // 头部model
|
9
|
const headerModel = require('../../../doraemon/models/header'); // 头部model
|
|
|
10
|
+const _=require('lodash');
|
10
|
|
11
|
|
11
|
|
12
|
|
12
|
const getResource = code => {
|
13
|
const getResource = code => {
|
|
@@ -91,6 +92,7 @@ const getPlatForm = (req) => { |
|
@@ -91,6 +92,7 @@ const getPlatForm = (req) => { |
91
|
let userAgent = req.get('User-Agent');
|
92
|
let userAgent = req.get('User-Agent');
|
92
|
let yoho = {};
|
93
|
let yoho = {};
|
93
|
let uids = req.get('User-Agent').match(/uid=([^;]+)/i);
|
94
|
let uids = req.get('User-Agent').match(/uid=([^;]+)/i);
|
|
|
95
|
+ let versions = req.get('User-Agent').match(/app_version=([^;]+)/i);
|
94
|
let arrs = [];
|
96
|
let arrs = [];
|
95
|
let isNewVersion = false;
|
97
|
let isNewVersion = false;
|
96
|
const isProduction = process.env.NODE_ENV === 'production';
|
98
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
@@ -98,8 +100,13 @@ const getPlatForm = (req) => { |
|
@@ -98,8 +100,13 @@ const getPlatForm = (req) => { |
98
|
yoho.isiOS = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(userAgent);
|
100
|
yoho.isiOS = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(userAgent);
|
99
|
yoho.isAndroid = /Android/i.test(userAgent);
|
101
|
yoho.isAndroid = /Android/i.test(userAgent);
|
100
|
yoho.isApp = /YohoBuy/i.test(req.get('User-Agent')) || (req.query.app_version && req.query.client_type);
|
102
|
yoho.isApp = /YohoBuy/i.test(req.get('User-Agent')) || (req.query.app_version && req.query.client_type);
|
101
|
- yoho.app_version = req.query.app_version || '';
|
103
|
+
|
|
|
104
|
+ yoho.app_version = versions && versions.length === 2 ? versions[1] : '';
|
|
|
105
|
+ yoho.app_version = yoho.app_version || req.query.app_version || '';
|
|
|
106
|
+ console.log("yoho.app_version");
|
|
|
107
|
+ console.log(yoho.app_version);
|
102
|
if (yoho.app_version) {
|
108
|
if (yoho.app_version) {
|
|
|
109
|
+ yoho.app_version=_.toString(yoho.app_version);
|
103
|
arrs = yoho.app_version.split('.');
|
110
|
arrs = yoho.app_version.split('.');
|
104
|
if (arrs.length > 2) {
|
111
|
if (arrs.length > 2) {
|
105
|
if (arrs[0] && +arrs[0] < 4) {
|
112
|
if (arrs[0] && +arrs[0] < 4) {
|
|
@@ -126,6 +133,7 @@ const getPlatForm = (req) => { |
|
@@ -126,6 +133,7 @@ const getPlatForm = (req) => { |
126
|
let data = yield getUser(yoho.uid);
|
133
|
let data = yield getUser(yoho.uid);
|
127
|
|
134
|
|
128
|
yoho.isStudent = data.data && data.data.vip_info && data.data.vip_info.is_student ? true : false;
|
135
|
yoho.isStudent = data.data && data.data.vip_info && data.data.vip_info.is_student ? true : false;
|
|
|
136
|
+
|
129
|
// yoho.isStudent = false;
|
137
|
// yoho.isStudent = false;
|
130
|
return yoho;
|
138
|
return yoho;
|
131
|
})();
|
139
|
})();
|
|
@@ -233,7 +241,8 @@ exports.index = (req, res, next) => { |
|
@@ -233,7 +241,8 @@ exports.index = (req, res, next) => { |
233
|
title: '有货学生专享优惠',
|
241
|
title: '有货学生专享优惠',
|
234
|
http: req.__USER__.http,
|
242
|
http: req.__USER__.http,
|
235
|
uid: req.__USER__.uid,
|
243
|
uid: req.__USER__.uid,
|
236
|
- app_version: req.__USER__.app_version
|
244
|
+ app_version: req.__USER__.app_version,
|
|
|
245
|
+ isAppNoLogin: req.__USER__.isApp && !req.__USER__.isLogin
|
237
|
};
|
246
|
};
|
238
|
if (!req.__USER__.isApp) {
|
247
|
if (!req.__USER__.isApp) {
|
239
|
options.pageHeader = headerModel.setNav({
|
248
|
options.pageHeader = headerModel.setNav({
|
|
@@ -341,7 +350,7 @@ exports.verifystudent = (req, res, next) => { |
|
@@ -341,7 +350,7 @@ exports.verifystudent = (req, res, next) => { |
341
|
Promise.all([verifiedStudentTotal(), vip(), verifyStudent(uid, params.college_name, params.education_degree, params.enrollment_year, params.token)])
|
350
|
Promise.all([verifiedStudentTotal(), vip(), verifyStudent(uid, params.college_name, params.education_degree, params.enrollment_year, params.token)])
|
342
|
.then((datas) => {
|
351
|
.then((datas) => {
|
343
|
let isverify = false,
|
352
|
let isverify = false,
|
344
|
- prompt = '你的学校信息未通审核';
|
353
|
+ prompt = '您的学校信息未通审核';
|
345
|
|
354
|
|
346
|
if (datas[2].code === 200) {
|
355
|
if (datas[2].code === 200) {
|
347
|
if (datas[2].code === 200) {
|
356
|
if (datas[2].code === 200) {
|