Authored by hongweigao

认证后结果,埋点修改

@@ -126,8 +126,7 @@ exports.stuVerify = (result, params) => { @@ -126,8 +126,7 @@ exports.stuVerify = (result, params) => {
126 126
127 if (result.code === 200) { 127 if (result.code === 200) {
128 data.isError = false; 128 data.isError = false;
129 - data = result.data;  
130 - data.isStudent = data.isStudent === 1 ? true : false; 129 + data.isStudent = result.data.isStudent === 1 ? true : false;
131 } else { 130 } else {
132 data.isError = true; 131 data.isError = true;
133 data.errorMsg = result.message; 132 data.errorMsg = result.message;
@@ -6,10 +6,6 @@ @@ -6,10 +6,6 @@
6 6
7 'use strict'; 7 'use strict';
8 8
9 -// const utils = '../../../utils';  
10 -  
11 -// const logger = global.yoho.logger;  
12 -// const camelCase = global.yoho.camelCase;  
13 const api = global.yoho.API; 9 const api = global.yoho.API;
14 const queryString = require('querystring'); 10 const queryString = require('querystring');
15 const _ = require('lodash'); 11 const _ = require('lodash');
@@ -70,8 +66,12 @@ exports.getStudentsData = (channel, req) => { @@ -70,8 +66,12 @@ exports.getStudentsData = (channel, req) => {
70 module: 'product', 66 module: 'product',
71 page: 'students', 67 page: 'students',
72 realData: { 68 realData: {
73 - sortItem: [{title: '学生权益介绍', href: 'stu-rights'}, {title: '我要验证身份', href: 'stu-identity'},  
74 - {title: '学生热门单品', href: 'stu-good'}, {title: '更多活动推荐', href: 'stu-activity'}], 69 + sortItem: [
  70 + {title: '学生权益介绍', href: 'stu-rights'},
  71 + {title: '我要验证身份', href: 'stu-identity'},
  72 + {title: '学生热门单品', href: 'stu-good'},
  73 + {title: '更多活动推荐', href: 'stu-activity'}
  74 + ],
75 identityItem: { 75 identityItem: {
76 stuNum: [] 76 stuNum: []
77 } 77 }
@@ -105,7 +105,7 @@ exports.getStudentsData = (channel, req) => { @@ -105,7 +105,7 @@ exports.getStudentsData = (channel, req) => {
105 } 105 }
106 106
107 if (result[4]) { 107 if (result[4]) {
108 - Object.assign(responseData.realData, {verifyRusult: stuHandler.stuVerify(result[4], params)}); 108 + Object.assign(responseData.realData.identityObj, {verifyRusult: stuHandler.stuVerify(result[4], params)});
109 } 109 }
110 110
111 return responseData; 111 return responseData;
@@ -116,33 +116,21 @@ exports.getStudentsData = (channel, req) => { @@ -116,33 +116,21 @@ exports.getStudentsData = (channel, req) => {
116 * 获取学校地区数据 116 * 获取学校地区数据
117 * @return Object 接口数据 117 * @return Object 接口数据
118 */ 118 */
119 -exports.getSchoolArea = () => {  
120 - return studentsApi.getArea().then(result => {  
121 - return result;  
122 - });  
123 -}; 119 +exports.getSchoolArea = studentsApi.getArea;
124 120
125 /** 121 /**
126 * 根据地区码查询学校列表 122 * 根据地区码查询学校列表
127 * @params areaCode int 地区码 123 * @params areaCode int 地区码
128 * @return Object 接口数据 124 * @return Object 接口数据
129 */ 125 */
130 -exports.getSchoolList = (areaCode) => {  
131 - return studentsApi.getSchool(areaCode).then(result => {  
132 - return result;  
133 - });  
134 -}; 126 +exports.getSchoolList = studentsApi.getSchool;
135 127
136 /** 128 /**
137 * 学历层次 129 * 学历层次
138 * @params areaCode int 地区码 130 * @params areaCode int 地区码
139 * @return Object 接口数据 131 * @return Object 接口数据
140 */ 132 */
141 -exports.getEduLevel = () => {  
142 - return studentsApi.getEduLevelList().then(result => {  
143 - return result;  
144 - });  
145 -}; 133 +exports.getEduLevel = studentsApi.getEduLevelList;
146 134
147 /** 135 /**
148 * 身份验证 136 * 身份验证
@@ -160,9 +148,7 @@ exports.verifyIdentity = (uid, params) => { @@ -160,9 +148,7 @@ exports.verifyIdentity = (uid, params) => {
160 enrollmentYear: params.enrollmentYear 148 enrollmentYear: params.enrollmentYear
161 }) + '&'; 149 }) + '&';
162 150
163 - return studentsApi.verifyIdentity(uid, params.certNo, params.name, pageUrl).then(result => {  
164 - return result;  
165 - }); 151 + return studentsApi.verifyIdentity(uid, params.certNo, params.name, pageUrl);
166 }; 152 };
167 153
168 /** 154 /**
@@ -171,10 +157,7 @@ exports.verifyIdentity = (uid, params) => { @@ -171,10 +157,7 @@ exports.verifyIdentity = (uid, params) => {
171 * @return Object 接口数据 157 * @return Object 接口数据
172 */ 158 */
173 exports.verifyStudents = (params) => { 159 exports.verifyStudents = (params) => {
174 - return studentsApi.verifyStudent(params.uid, params.collegeName, params.educationDegree, params.enrollmentYear).  
175 - then(result => {  
176 - return result;  
177 - }); 160 + return studentsApi.verifyStudent(params.uid, params.collegeName, params.educationDegree, params.enrollmentYear);
178 }; 161 };
179 162
180 /** 163 /**
@@ -183,24 +166,12 @@ exports.verifyStudents = (params) => { @@ -183,24 +166,12 @@ exports.verifyStudents = (params) => {
183 * @return 166 * @return
184 */ 167 */
185 exports.userAcquireStatus = (uid, couponIds) => { 168 exports.userAcquireStatus = (uid, couponIds) => {
186 - let ids = ''; 169 + let ids = couponIds.map(coupon => crypto.decrypt(null, coupon)).join(',');
187 170
188 - for (let i = 0; i < couponIds.length; i++) {  
189 - if (i === couponIds.length - 1) {  
190 - ids += crypto.decrypt('yoho9646abcdefgh', couponIds[i]);  
191 - } else {  
192 - ids += crypto.decrypt('yoho9646abcdefgh', couponIds[i]) + ',';  
193 - }  
194 - }  
195 -  
196 - return studentsApi.userAcquireStatus(uid, ids).  
197 - then(result => { 171 + return studentsApi.userAcquireStatus(uid, ids).then(result => {
198 if (result.code === 200) { 172 if (result.code === 200) {
199 _.forEach(result.data, (value) => { 173 _.forEach(result.data, (value) => {
200 - let couponId = value.couponId.toString(),  
201 - cryptoId = crypto.encryption('yoho9646abcdefgh', couponId);  
202 -  
203 - value.couponId = cryptoId; 174 + value.couponId = crypto.encryption(null, value.couponId + '');
204 }); 175 });
205 } 176 }
206 return result; 177 return result;
@@ -632,6 +632,31 @@ $(function() { @@ -632,6 +632,31 @@ $(function() {
632 ACTION_ID: 0, 632 ACTION_ID: 0,
633 REC_ID: recId 633 REC_ID: recId
634 }); 634 });
  635 +
  636 + if ($('#identity-success').length > 0) {
  637 + // xls-4学生认证成功埋点
  638 + givePoint('YB_STUDENT_ATTCT_RESULT', {
  639 + SRC_ID: 5,
  640 + SUBMIT_RES: 1,
  641 + ATTCT_INFO: {
  642 + birthDay: $('.identity-back-wrap .result-birthDay').html(),
  643 + sex: $('.identity-back-wrap .result-sex').html(),
  644 + collegeName: $('.identity-back-wrap .result-collegeName').html(),
  645 + educationDegree: $('.identity-back-wrap .result-educationDegree').html(),
  646 + enrollmentYear: $('.identity-back-wrap .result-enrollmentYear').html()
  647 + }
  648 + });
  649 + }
  650 +
  651 + if ($('#identity-fail').length > 0) {
  652 + // xls-4学生认证失败埋点
  653 + givePoint('YB_STUDENT_ATTCT_RESULT', {
  654 + SRC_ID: 5,
  655 + SUBMIT_RES: 2,
  656 + FAILURE_CAUSE: $('#identity-fail-text').html()
  657 + });
  658 + }
  659 +
635 clearInterval(sto); 660 clearInterval(sto);
636 } 661 }
637 }, 100); 662 }, 100);
@@ -698,31 +723,6 @@ $(function() { @@ -698,31 +723,6 @@ $(function() {
698 }); 723 });
699 } 724 }
700 725
701 - if ($('#identity-success').length > 0) {  
702 - // xls-4学生认证成功埋点  
703 - givePoint('YB_STUDENT_ATTCT_RESULT', {  
704 - SRC_ID: 5,  
705 - SUBMIT_RES: 1,  
706 - ATTCT_INFO: {  
707 - birthDay: $('.identity-back-wrap .result-birthDay').html(),  
708 - sex: $('.identity-back-wrap .result-sex').html(),  
709 - collegeName: $('.identity-back-wrap .result-collegeName').html(),  
710 - educationDegree: $('.identity-back-wrap .result-educationDegree').html(),  
711 - enrollmentYear: $('.identity-back-wrap .result-enrollmentYear').html()  
712 - }  
713 - });  
714 - }  
715 -  
716 - if ($('#identity-fail').length > 0) {  
717 - // xls-4学生认证失败埋点  
718 - givePoint('YB_STUDENT_ATTCT_RESULT', {  
719 - SRC_ID: 5,  
720 - SUBMIT_RES: 2,  
721 - FAILURE_CAUSE: $('#identity-fail-text').html()  
722 - });  
723 - }  
724 -  
725 -  
726 $('.banner-img').click(function() { 726 $('.banner-img').click(function() {
727 var url = $(this).children().attr('href'), 727 var url = $(this).children().attr('href'),
728 index = $(this).index(); 728 index = $(this).index();