|
@@ -13,25 +13,6 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model |
|
@@ -13,25 +13,6 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model |
13
|
const _ = require('lodash');
|
13
|
const _ = require('lodash');
|
14
|
const urlP = require('url');
|
14
|
const urlP = require('url');
|
15
|
|
15
|
|
16
|
-/**
|
|
|
17
|
- * 处理旧版本的app兼容新接口
|
|
|
18
|
- * @param {*} url url
|
|
|
19
|
- * @param {*} data data
|
|
|
20
|
- * @param {*} param param
|
|
|
21
|
- * @param {*} method method
|
|
|
22
|
- */
|
|
|
23
|
-const middleApi = (url, data, param, method) => {
|
|
|
24
|
- try {
|
|
|
25
|
- let promise = method === 'post' ? api.post : api.get;
|
|
|
26
|
-
|
|
|
27
|
- if (!_.get(data, 'uid.sessionKey', '') && data.uid) {
|
|
|
28
|
- data.app_version = '5.5.0';
|
|
|
29
|
- }
|
|
|
30
|
- return promise.call(api, url, data, param);
|
|
|
31
|
- } catch (err) {
|
|
|
32
|
- return null;
|
|
|
33
|
- }
|
|
|
34
|
-};
|
|
|
35
|
const getResource = code => {
|
16
|
const getResource = code => {
|
36
|
return serviceApi.get('operations/api/v5/resource/get', {
|
17
|
return serviceApi.get('operations/api/v5/resource/get', {
|
37
|
content_code: code,
|
18
|
content_code: code,
|
|
@@ -39,43 +20,43 @@ const getResource = code => { |
|
@@ -39,43 +20,43 @@ const getResource = code => { |
39
|
});
|
20
|
});
|
40
|
};
|
21
|
};
|
41
|
const vip = (limit) => {
|
22
|
const vip = (limit) => {
|
42
|
- return middleApi('', {
|
23
|
+ return api.get('', {
|
43
|
method: 'app.student.vip',
|
24
|
method: 'app.student.vip',
|
44
|
limit: limit || 60
|
25
|
limit: limit || 60
|
45
|
});
|
26
|
});
|
46
|
};
|
27
|
};
|
47
|
const verifiedStudentTotal = () => {
|
28
|
const verifiedStudentTotal = () => {
|
48
|
- return middleApi('', {
|
29
|
+ return api.get('', {
|
49
|
method: 'app.student.verifiedStudentTotal'
|
30
|
method: 'app.student.verifiedStudentTotal'
|
50
|
});
|
31
|
});
|
51
|
};
|
32
|
};
|
52
|
const getProvince = () => {
|
33
|
const getProvince = () => {
|
53
|
- return middleApi('', {
|
34
|
+ return api.get('', {
|
54
|
method: 'app.studentMarket.getAddressList'
|
35
|
method: 'app.studentMarket.getAddressList'
|
55
|
}, {
|
36
|
}, {
|
56
|
cache: true
|
37
|
cache: true
|
57
|
});
|
38
|
});
|
58
|
};
|
39
|
};
|
59
|
const getSchool = code => {
|
40
|
const getSchool = code => {
|
60
|
- return middleApi('', {
|
41
|
+ return api.get('', {
|
61
|
method: 'app.studentMarket.getSchoolInfoList',
|
42
|
method: 'app.studentMarket.getSchoolInfoList',
|
62
|
areaCode: code
|
43
|
areaCode: code
|
63
|
});
|
44
|
});
|
64
|
};
|
45
|
};
|
65
|
const getEducationLevelList = () => {
|
46
|
const getEducationLevelList = () => {
|
66
|
- return middleApi('', {
|
47
|
+ return api.get('', {
|
67
|
method: 'app.studentMarket.getEducationLevelList'
|
48
|
method: 'app.studentMarket.getEducationLevelList'
|
68
|
});
|
49
|
});
|
69
|
};
|
50
|
};
|
70
|
const userAcquireStatus = (uid, couponIds) => {
|
51
|
const userAcquireStatus = (uid, couponIds) => {
|
71
|
- return middleApi('', {
|
52
|
+ return api.get('', {
|
72
|
method: 'app.coupons.userAcquireStatus',
|
53
|
method: 'app.coupons.userAcquireStatus',
|
73
|
uid: uid,
|
54
|
uid: uid,
|
74
|
couponIds: couponIds
|
55
|
couponIds: couponIds
|
75
|
});
|
56
|
});
|
76
|
};
|
57
|
};
|
77
|
const verifyStudent = (uid, collegename, educationdegree, enrollmentyear) => {
|
58
|
const verifyStudent = (uid, collegename, educationdegree, enrollmentyear) => {
|
78
|
- return middleApi('', {
|
59
|
+ return api.get('', {
|
79
|
method: 'app.student.verifyStudent',
|
60
|
method: 'app.student.verifyStudent',
|
80
|
uid: uid,
|
61
|
uid: uid,
|
81
|
client_type: 'h5',
|
62
|
client_type: 'h5',
|
|
@@ -85,7 +66,7 @@ const verifyStudent = (uid, collegename, educationdegree, enrollmentyear) => { |
|
@@ -85,7 +66,7 @@ const verifyStudent = (uid, collegename, educationdegree, enrollmentyear) => { |
85
|
});
|
66
|
});
|
86
|
};
|
67
|
};
|
87
|
const verifyIdentity = (uid, certno, name, pageurl) => {
|
68
|
const verifyIdentity = (uid, certno, name, pageurl) => {
|
88
|
- return middleApi('', {
|
69
|
+ return api.get('', {
|
89
|
method: 'app.student.verifyIdentity',
|
70
|
method: 'app.student.verifyIdentity',
|
90
|
uid: uid,
|
71
|
uid: uid,
|
91
|
client_type: 'h5',
|
72
|
client_type: 'h5',
|
|
@@ -101,7 +82,7 @@ const getUser = (uid) => { |
|
@@ -101,7 +82,7 @@ const getUser = (uid) => { |
101
|
data: {}
|
82
|
data: {}
|
102
|
});
|
83
|
});
|
103
|
}
|
84
|
}
|
104
|
- return middleApi('', {
|
85
|
+ return api.get('', {
|
105
|
method: 'app.passport.profile',
|
86
|
method: 'app.passport.profile',
|
106
|
uid: uid
|
87
|
uid: uid
|
107
|
}, {
|
88
|
}, {
|
|
@@ -153,7 +134,7 @@ const getPlatForm = (req) => { |
|
@@ -153,7 +134,7 @@ const getPlatForm = (req) => { |
153
|
if (isProduction) {
|
134
|
if (isProduction) {
|
154
|
yoho.http = 'https:';
|
135
|
yoho.http = 'https:';
|
155
|
}
|
136
|
}
|
156
|
- yoho.uid = req.user.uid;
|
137
|
+ yoho.uid = req.user.uid || req.query.uid;
|
157
|
yoho.isLogin = yoho.uid ? true : false;
|
138
|
yoho.isLogin = yoho.uid ? true : false;
|
158
|
return co(function*() {
|
139
|
return co(function*() {
|
159
|
let data = yield getUser(yoho.uid);
|
140
|
let data = yield getUser(yoho.uid);
|
|
@@ -391,7 +372,7 @@ exports.verifyidentity = (req, res, next) => { |
|
@@ -391,7 +372,7 @@ exports.verifyidentity = (req, res, next) => { |
391
|
|
372
|
|
392
|
// 添加分享成功记录
|
373
|
// 添加分享成功记录
|
393
|
const addStudent = (ownuid, shareId) => {
|
374
|
const addStudent = (ownuid, shareId) => {
|
394
|
- return middleApi('', {
|
375
|
+ return api.get('', {
|
395
|
method: 'app.student.addShare',
|
376
|
method: 'app.student.addShare',
|
396
|
uid: ownuid,
|
377
|
uid: ownuid,
|
397
|
shareUid: shareId
|
378
|
shareUid: shareId
|