|
@@ -11,6 +11,7 @@ |
|
@@ -11,6 +11,7 @@ |
11
|
// const logger = global.yoho.logger;
|
11
|
// const logger = global.yoho.logger;
|
12
|
// const camelCase = global.yoho.camelCase;
|
12
|
// const camelCase = global.yoho.camelCase;
|
13
|
const api = global.yoho.API;
|
13
|
const api = global.yoho.API;
|
|
|
14
|
+const queryString = require('querystring');
|
14
|
|
15
|
|
15
|
const studentsApi = require('./students-api');
|
16
|
const studentsApi = require('./students-api');
|
16
|
const stuHandler = require('./students-handler');
|
17
|
const stuHandler = require('./students-handler');
|
|
@@ -29,8 +30,8 @@ const studentsCode = '989396a17443bf61e3e269702e51ef04'; // h5 a83b7d55324fb65f9 |
|
@@ -29,8 +30,8 @@ const studentsCode = '989396a17443bf61e3e269702e51ef04'; // h5 a83b7d55324fb65f9 |
29
|
* @params channel Object 频道
|
30
|
* @params channel Object 频道
|
30
|
* @return name returnType 返回值描述
|
31
|
* @return name returnType 返回值描述
|
31
|
*/
|
32
|
*/
|
32
|
-exports.getStudentsData = (channel) => {
|
|
|
33
|
- return api.all([
|
33
|
+exports.getStudentsData = (channel, req) => {
|
|
|
34
|
+ let apiMethod = [
|
34
|
headerModel.requestHeaderData(channel),
|
35
|
headerModel.requestHeaderData(channel),
|
35
|
|
36
|
|
36
|
// 资源位数据
|
37
|
// 资源位数据
|
|
@@ -41,8 +42,17 @@ exports.getStudentsData = (channel) => { |
|
@@ -41,8 +42,17 @@ exports.getStudentsData = (channel) => { |
41
|
|
42
|
|
42
|
// 商品数据
|
43
|
// 商品数据
|
43
|
studentsApi.getStuProducts()
|
44
|
studentsApi.getStuProducts()
|
|
|
45
|
+ ];
|
44
|
|
46
|
|
45
|
- ]).then(result => {
|
47
|
+
|
|
|
48
|
+ if (req.user.uid && req.query.collegeName && req.query.educationDegree &&
|
|
|
49
|
+ req.query.enrollmentYear && req.query.sign) {
|
|
|
50
|
+ apiMethod.push(
|
|
|
51
|
+ studentsApi.verifyStudent(req.user.uid, req.query.collegeName,
|
|
|
52
|
+ req.query.educationDegree, req.query.enrollmentYear)
|
|
|
53
|
+ );
|
|
|
54
|
+ }
|
|
|
55
|
+ return api.all(apiMethod).then(result => {
|
46
|
let responseData = {
|
56
|
let responseData = {
|
47
|
module: 'product',
|
57
|
module: 'product',
|
48
|
page: 'students',
|
58
|
page: 'students',
|
|
@@ -52,8 +62,11 @@ exports.getStudentsData = (channel) => { |
|
@@ -52,8 +62,11 @@ exports.getStudentsData = (channel) => { |
52
|
|
62
|
|
53
|
realData: {
|
63
|
realData: {
|
54
|
sortItem: [{title: '学生权益介绍', href: 'stu-rights'}, {title: '我要验证身份', href: 'stu-identity'},
|
64
|
sortItem: [{title: '学生权益介绍', href: 'stu-rights'}, {title: '我要验证身份', href: 'stu-identity'},
|
55
|
- {title: '学生热门单品', href: 'stu-good'}, {title: '更多活动推荐', href: 'stu-activity'}]
|
|
|
56
|
-
|
65
|
+ {title: '学生热门单品', href: 'stu-good'}, {title: '更多活动推荐', href: 'stu-activity'}],
|
|
|
66
|
+ identityItem: {
|
|
|
67
|
+ sendCoin: 100,
|
|
|
68
|
+ stuNum: []
|
|
|
69
|
+ }
|
57
|
},
|
70
|
},
|
58
|
|
71
|
|
59
|
footerTop: true
|
72
|
footerTop: true
|
|
@@ -64,13 +77,19 @@ exports.getStudentsData = (channel) => { |
|
@@ -64,13 +77,19 @@ exports.getStudentsData = (channel) => { |
64
|
Object.assign(responseData.realData, stuHandler.studentResource(result[1].data));
|
77
|
Object.assign(responseData.realData, stuHandler.studentResource(result[1].data));
|
65
|
}
|
78
|
}
|
66
|
|
79
|
|
67
|
- // if (result[2].code === 200) {
|
|
|
68
|
-
|
|
|
69
|
- // }
|
80
|
+ if (result[2].code === 200) {
|
|
|
81
|
+ responseData.realData.identityItem.stuNum = stuHandler.studentsNum(result[2].data);
|
|
|
82
|
+ }
|
70
|
|
83
|
|
71
|
if (result[3].code === 200) {
|
84
|
if (result[3].code === 200) {
|
72
|
Object.assign(responseData.realData, {proItem: stuHandler.stuProducts(result[3].data.product_list)});
|
85
|
Object.assign(responseData.realData, {proItem: stuHandler.stuProducts(result[3].data.product_list)});
|
73
|
}
|
86
|
}
|
|
|
87
|
+
|
|
|
88
|
+ // console.log(result[4]);
|
|
|
89
|
+ // if (result[4] && result[4].code === 200) {
|
|
|
90
|
+ // console.log(result[4]);
|
|
|
91
|
+ // }
|
|
|
92
|
+
|
74
|
return responseData;
|
93
|
return responseData;
|
75
|
});
|
94
|
});
|
76
|
};
|
95
|
};
|
|
@@ -269,8 +288,12 @@ exports.getEduLevel = () => { |
|
@@ -269,8 +288,12 @@ exports.getEduLevel = () => { |
269
|
* @params areaCode int 地区码
|
288
|
* @params areaCode int 地区码
|
270
|
* @return Object 接口数据
|
289
|
* @return Object 接口数据
|
271
|
*/
|
290
|
*/
|
272
|
-exports.verifyIdentity = () => {
|
|
|
273
|
- return studentsApi.verifyIdentity().then(result => {
|
291
|
+exports.verifyIdentity = (uid, params) => {
|
|
|
292
|
+ let pageUrl = 'http://localhost:6001/product/students?' +
|
|
|
293
|
+ queryString.stringify({collegeName: params.collegeName,
|
|
|
294
|
+ educationDegree: params.educationDegree, enrollmentYear: params.enrollmentYear});
|
|
|
295
|
+
|
|
|
296
|
+ return studentsApi.verifyIdentity(uid, params.certNo, params.name, pageUrl).then(result => {
|
274
|
return result;
|
297
|
return result;
|
275
|
});
|
298
|
});
|
276
|
};
|
299
|
};
|
|
@@ -281,9 +304,10 @@ exports.verifyIdentity = () => { |
|
@@ -281,9 +304,10 @@ exports.verifyIdentity = () => { |
281
|
* @return Object 接口数据
|
304
|
* @return Object 接口数据
|
282
|
*/
|
305
|
*/
|
283
|
exports.verifyStudents = (uid, params) => {
|
306
|
exports.verifyStudents = (uid, params) => {
|
284
|
- let pageUrl = '/product/students?';
|
|
|
285
|
|
307
|
|
286
|
- return studentsApi.verifyIdentity(uid, params.certNo, params.name, pageUrl).then(result => {
|
308
|
+
|
|
|
309
|
+ return studentsApi.verifyIdentity(uid, params.collegeName, params.educationDegree, params.enrollmentYear).
|
|
|
310
|
+ then(result => {
|
287
|
return result;
|
311
|
return result;
|
288
|
});
|
312
|
});
|
289
|
}; |
313
|
}; |