Authored by zhangxiaoru

数据判断 下载

@@ -11,11 +11,13 @@ const _ = require('lodash'); @@ -11,11 +11,13 @@ const _ = require('lodash');
11 const productProcess = require(`${utils}/product-process`); 11 const productProcess = require(`${utils}/product-process`);
12 12
13 const userAcquireStatus = (uid, couponIds) => { 13 const userAcquireStatus = (uid, couponIds) => {
14 - return api.get('', {  
15 - method: 'app.coupons.userAcquireStatus',  
16 - uid: uid,  
17 - couponIds: couponIds  
18 - }); 14 + if (couponIds != '') {
  15 + return api.get('', {
  16 + method: 'app.coupons.userAcquireStatus',
  17 + uid: uid,
  18 + couponIds: couponIds
  19 + });
  20 + }
19 }; 21 };
20 22
21 /** 23 /**
@@ -24,35 +26,36 @@ const userAcquireStatus = (uid, couponIds) => { @@ -24,35 +26,36 @@ const userAcquireStatus = (uid, couponIds) => {
24 * @returns {*} 26 * @returns {*}
25 */ 27 */
26 const _getRelatedData = (idList) => { 28 const _getRelatedData = (idList) => {
27 - return api.get('', {  
28 - productSkn: idList,  
29 - method: 'h5.product.batch'  
30 - }).then((result) => { 29 + if (idList != '') {
  30 + return api.get('', {
  31 + productSkn: idList,
  32 + method: 'h5.product.batch'
  33 + }).then((result) => {
31 34
32 - let goods = [],  
33 - productList = []; 35 + let goods = [],
  36 + productList = [];
34 37
35 - if (result && result.data.product_list && result.code === 200) { 38 + if (result && result.data && result.data.product_list && result.code === 200) {
36 39
37 - _.forEach(result.data.product_list, function(val) { 40 + _.forEach(result.data.product_list, function(val) {
38 41
39 - if (val.student_price) {  
40 - productList.push(val);  
41 - }  
42 - }); 42 + if (val.student_price) {
  43 + productList.push(val);
  44 + }
  45 + });
43 46
44 - goods = productProcess.processProductList(productList); 47 + goods = productProcess.processProductList(productList);
45 48
46 - return goods;  
47 - } else {  
48 - logger.error('推荐商品 cood 不是 200');  
49 - return {};  
50 - }  
51 - }); 49 + return goods;
  50 + } else {
  51 + return {};
  52 + }
  53 + });
  54 + }
52 }; 55 };
53 56
54 exports.index = (req, res, next) => { 57 exports.index = (req, res, next) => {
55 - let code = '50b995e190ff8cfe52989972a4943b06'; 58 + let code = 'c9b9639ce2884b768cfbc5cf9e68a53f';
56 let uid = req.__USER__.uid; 59 let uid = req.__USER__.uid;
57 let options; 60 let options;
58 let noLoginUrl = helpers.urlFormat('/activity/student/register') + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student-market"}}}'; 61 let noLoginUrl = helpers.urlFormat('/activity/student/register') + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student-market"}}}';
@@ -62,7 +65,7 @@ exports.index = (req, res, next) => { @@ -62,7 +65,7 @@ exports.index = (req, res, next) => {
62 platform: 'iphone' 65 platform: 'iphone'
63 }).then((result) => { 66 }).then((result) => {
64 67
65 - let coupons, 68 + let coupons = {},
66 activities, 69 activities,
67 banner, 70 banner,
68 icons, 71 icons,
@@ -171,24 +174,13 @@ exports.index = (req, res, next) => { @@ -171,24 +174,13 @@ exports.index = (req, res, next) => {
171 options.loginUrl = '//m.yohobuy.com/activity/student/register'; 174 options.loginUrl = '//m.yohobuy.com/activity/student/register';
172 if (options.isApp) { 175 if (options.isApp) {
173 if (options.isLogin) { 176 if (options.isLogin) {
174 - if (options.isStudent) {  
175 - // options.loginUrl = false;  
176 - } else {  
177 - options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register"}}';  
178 - } 177 + options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register"}}';
179 } else { 178 } else {
180 // no login 179 // no login
181 options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register","antarget":"1"}}}'; 180 options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register","antarget":"1"}}}';
182 } 181 }
183 - } else {  
184 - if (options.isLogin) {  
185 - if (options.isStudent) {  
186 - // options.loginUrl = false;  
187 - }  
188 - }  
189 - } 182 + }
190 183
191 - // console.log(options);  
192 res.render('student-market', options); 184 res.render('student-market', options);
193 185
194 }).catch(next); 186 }).catch(next);
@@ -491,16 +491,10 @@ $('#float-layer-close').on('touchend', function() { @@ -491,16 +491,10 @@ $('#float-layer-close').on('touchend', function() {
491 491
492 if ($('#float-layer-btn') && $('#float-layer-btn')[0]) { 492 if ($('#float-layer-btn') && $('#float-layer-btn')[0]) {
493 var floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]); 493 var floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]);
  494 + var unionType = window.queryString.union_type || 367;
494 floatLayerBtnHammer.on('tap', function(e) { 495 floatLayerBtnHammer.on('tap', function(e) {
495 - var downUrl = 'http://union.yoho.cn/union/downapp.html?union_type=367';  
496 496
497 - window.downLoadApp(downUrl); 497 + window.downLoadApp(unionType);
498 e.srcEvent.stopPropagation(); 498 e.srcEvent.stopPropagation();
499 }); 499 });
500 -  
501 - if (typeof window.cookie === 'function' && !window.cookie('_float-layer-app')) {  
502 - $('#float-layer-app').show();  
503 - } else {  
504 - $('#float-layer-app').hide();  
505 - }  
506 } 500 }
@@ -308,12 +308,12 @@ if ($footer.find('.user-name').text().length === 11) { @@ -308,12 +308,12 @@ if ($footer.find('.user-name').text().length === 11) {
308 } 308 }
309 309
310 // 浮层下载APP 310 // 浮层下载APP
311 -function downLoadApp(downUrl) {  
312 - var appUrl = downUrl || 'http://union.yoho.cn/union/downapp.html'; 311 +function downLoadApp(unionType) {
  312 + var appUrl ='http://union.yoho.cn/union/downapp.html';
313 var clickedAt = new Date(); 313 var clickedAt = new Date();
314 314
315 setTimeout(function() { 315 setTimeout(function() {
316 - var mkt = queryString().union_type || cookie('unionTypeYas') || false; 316 + var mkt = unionType || queryString().union_type || cookie('unionTypeYas') || false;
317 317
318 if ((new Date()) - clickedAt < 2000) { 318 if ((new Date()) - clickedAt < 2000) {
319 if (mkt) { 319 if (mkt) {
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 font-size: 20px; 11 font-size: 20px;
12 width: 110px; 12 width: 110px;
13 height: 48px; 13 height: 48px;
14 - line-height: 52px; 14 + line-height: 51px;
15 color: #fff; 15 color: #fff;
16 background-color: #d10922; 16 background-color: #d10922;
17 border-radius: 20px; 17 border-radius: 20px;