...
|
...
|
@@ -11,6 +11,7 @@ |
|
|
// const logger = global.yoho.logger;
|
|
|
// const camelCase = global.yoho.camelCase;
|
|
|
const api = global.yoho.API;
|
|
|
const queryString = require('querystring');
|
|
|
|
|
|
const studentsApi = require('./students-api');
|
|
|
const stuHandler = require('./students-handler');
|
...
|
...
|
@@ -29,8 +30,8 @@ const studentsCode = '989396a17443bf61e3e269702e51ef04'; // h5 a83b7d55324fb65f9 |
|
|
* @params channel Object 频道
|
|
|
* @return name returnType 返回值描述
|
|
|
*/
|
|
|
exports.getStudentsData = (channel) => {
|
|
|
return api.all([
|
|
|
exports.getStudentsData = (channel, req) => {
|
|
|
let apiMethod = [
|
|
|
headerModel.requestHeaderData(channel),
|
|
|
|
|
|
// 资源位数据
|
...
|
...
|
@@ -41,8 +42,17 @@ exports.getStudentsData = (channel) => { |
|
|
|
|
|
// 商品数据
|
|
|
studentsApi.getStuProducts()
|
|
|
];
|
|
|
|
|
|
]).then(result => {
|
|
|
|
|
|
if (req.user.uid && req.query.collegeName && req.query.educationDegree &&
|
|
|
req.query.enrollmentYear && req.query.sign) {
|
|
|
apiMethod.push(
|
|
|
studentsApi.verifyStudent(req.user.uid, req.query.collegeName,
|
|
|
req.query.educationDegree, req.query.enrollmentYear)
|
|
|
);
|
|
|
}
|
|
|
return api.all(apiMethod).then(result => {
|
|
|
let responseData = {
|
|
|
module: 'product',
|
|
|
page: 'students',
|
...
|
...
|
@@ -52,8 +62,11 @@ exports.getStudentsData = (channel) => { |
|
|
|
|
|
realData: {
|
|
|
sortItem: [{title: '学生权益介绍', href: 'stu-rights'}, {title: '我要验证身份', href: 'stu-identity'},
|
|
|
{title: '学生热门单品', href: 'stu-good'}, {title: '更多活动推荐', href: 'stu-activity'}]
|
|
|
|
|
|
{title: '学生热门单品', href: 'stu-good'}, {title: '更多活动推荐', href: 'stu-activity'}],
|
|
|
identityItem: {
|
|
|
sendCoin: 100,
|
|
|
stuNum: []
|
|
|
}
|
|
|
},
|
|
|
|
|
|
footerTop: true
|
...
|
...
|
@@ -64,13 +77,19 @@ exports.getStudentsData = (channel) => { |
|
|
Object.assign(responseData.realData, stuHandler.studentResource(result[1].data));
|
|
|
}
|
|
|
|
|
|
// if (result[2].code === 200) {
|
|
|
|
|
|
// }
|
|
|
if (result[2].code === 200) {
|
|
|
responseData.realData.identityItem.stuNum = stuHandler.studentsNum(result[2].data);
|
|
|
}
|
|
|
|
|
|
if (result[3].code === 200) {
|
|
|
Object.assign(responseData.realData, {proItem: stuHandler.stuProducts(result[3].data.product_list)});
|
|
|
}
|
|
|
|
|
|
// console.log(result[4]);
|
|
|
// if (result[4] && result[4].code === 200) {
|
|
|
// console.log(result[4]);
|
|
|
// }
|
|
|
|
|
|
return responseData;
|
|
|
});
|
|
|
};
|
...
|
...
|
@@ -269,8 +288,12 @@ exports.getEduLevel = () => { |
|
|
* @params areaCode int 地区码
|
|
|
* @return Object 接口数据
|
|
|
*/
|
|
|
exports.verifyIdentity = () => {
|
|
|
return studentsApi.verifyIdentity().then(result => {
|
|
|
exports.verifyIdentity = (uid, params) => {
|
|
|
let pageUrl = 'http://localhost:6001/product/students?' +
|
|
|
queryString.stringify({collegeName: params.collegeName,
|
|
|
educationDegree: params.educationDegree, enrollmentYear: params.enrollmentYear});
|
|
|
|
|
|
return studentsApi.verifyIdentity(uid, params.certNo, params.name, pageUrl).then(result => {
|
|
|
return result;
|
|
|
});
|
|
|
};
|
...
|
...
|
@@ -281,9 +304,10 @@ exports.verifyIdentity = () => { |
|
|
* @return Object 接口数据
|
|
|
*/
|
|
|
exports.verifyStudents = (uid, params) => {
|
|
|
let pageUrl = '/product/students?';
|
|
|
|
|
|
return studentsApi.verifyIdentity(uid, params.certNo, params.name, pageUrl).then(result => {
|
|
|
|
|
|
return studentsApi.verifyIdentity(uid, params.collegeName, params.educationDegree, params.enrollmentYear).
|
|
|
then(result => {
|
|
|
return result;
|
|
|
});
|
|
|
}; |
...
|
...
|
|