Authored by 郭成尧

Merge branch 'master' into feature/passback

@@ -20,7 +20,7 @@ exports.cartPayAPI = (params) => { @@ -20,7 +20,7 @@ exports.cartPayAPI = (params) => {
20 method: params.activityInfo ? 'app.Shopping.easyPayment' : 'app.Shopping.payment', 20 method: params.activityInfo ? 'app.Shopping.easyPayment' : 'app.Shopping.payment',
21 enable_red_envelopes: 0, // h5不返回红包 21 enable_red_envelopes: 0, // h5不返回红包
22 cart_type: params.cart_type, 22 cart_type: params.cart_type,
23 - yoho_coin_mode: params.yoho_coin_mode, 23 + yoho_coin_mode: params.yoho_coin_mode || 0,
24 uid: params.uid 24 uid: params.uid
25 }; 25 };
26 26
@@ -129,9 +129,9 @@ @@ -129,9 +129,9 @@
129 </a> 129 </a>
130 </div> 130 </div>
131 <div class="group-list"> 131 <div class="group-list">
132 - <a class="list-item invite" href="http://activity.yoho.cn/feature/623.html?share_id=2795&title=邀请好友100元现金券无限赚"> 132 + <a class="list-item invite" href="https://activity.yoho.cn/feature/357.html?share_id=2391&title=邀请好友50元现金券无限赚">
133 <span class="horn"></span> 133 <span class="horn"></span>
134 - 邀请好友,100元礼券无限赚! 134 + 邀请好友,50元现金券无限赚!
135 <span class="iconfont num">&#xe604;</span> 135 <span class="iconfont num">&#xe604;</span>
136 </a> 136 </a>
137 <a class="list-item message" href="/home/message"> 137 <a class="list-item message" href="/home/message">
@@ -266,7 +266,7 @@ const local = { @@ -266,7 +266,7 @@ const local = {
266 captchaShow: true 266 captchaShow: true
267 }; 267 };
268 268
269 - cache.set(`loginErrorIp:${req.yoho.clientIp}`, true, 3600).catch(log.error); 269 + cache.set(`loginErrorIp:${req.yoho.clientIp}`, true, 3600 * 24).catch(log.error);
270 return res.json(obj); 270 return res.json(obj);
271 } 271 }
272 } else { 272 } else {
@@ -491,7 +491,16 @@ exports.loginShowCaptchaByIp = function(req, res, next) { @@ -491,7 +491,16 @@ exports.loginShowCaptchaByIp = function(req, res, next) {
491 req.yoho.captchaShow = false; 491 req.yoho.captchaShow = false;
492 } 492 }
493 493
494 - co(function*() { 494 + // 第一次登录要不要展示验证码:后台开关勾选,首次登录不需要展示
  495 + let firstLoginShowCaptcha = !_.get(req.app.locals.wap, 'close.firstLoginShowCaptcha', false);
  496 +
  497 + log.info(`firstLoginShowCaptcha status is ${firstLoginShowCaptcha}`);
  498 +
  499 + if (firstLoginShowCaptcha) {
  500 + req.yoho.captchaShow = true;
  501 + return next();
  502 + } else {
  503 + co(function* () {
495 let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`); 504 let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`);
496 505
497 log.info(`Pagerender clientip ${req.yoho.clientIp} status is ` + hasErrorLog); 506 log.info(`Pagerender clientip ${req.yoho.clientIp} status is ` + hasErrorLog);
@@ -504,6 +513,7 @@ exports.loginShowCaptchaByIp = function(req, res, next) { @@ -504,6 +513,7 @@ exports.loginShowCaptchaByIp = function(req, res, next) {
504 req.yoho.captchaShow = true; 513 req.yoho.captchaShow = true;
505 next(); 514 next();
506 }); 515 });
  516 + }
507 }; 517 };
508 518
509 exports.common = common; 519 exports.common = common;
@@ -29,6 +29,14 @@ const check = (req, res, next) => { @@ -29,6 +29,14 @@ const check = (req, res, next) => {
29 co(function* () { 29 co(function* () {
30 // 如果是账号密码登录,那么需要检查是否登录失败过,登录失败过展示验证码 30 // 如果是账号密码登录,那么需要检查是否登录失败过,登录失败过展示验证码
31 if (req.path === '/passport/login/auth') { 31 if (req.path === '/passport/login/auth') {
  32 + // 第一次登录要不要展示验证码:后台开关勾选,首次登录不需要展示
  33 + let firstLoginShowCaptcha = !_.get(req.app.locals.wap, 'close.firstLoginShowCaptcha', false);
  34 +
  35 + log.info(`firstLoginShowCaptcha status is ${firstLoginShowCaptcha}`);
  36 +
  37 + if (firstLoginShowCaptcha) {
  38 + req.yoho.captchaShow = true;
  39 + } else {
32 let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`); 40 let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`);
33 41
34 log.info(`Check clientip ${req.yoho.clientIp} status is ` + hasErrorLog); 42 log.info(`Check clientip ${req.yoho.clientIp} status is ` + hasErrorLog);
@@ -39,6 +47,7 @@ const check = (req, res, next) => { @@ -39,6 +47,7 @@ const check = (req, res, next) => {
39 req.yoho.captchaShow = false; 47 req.yoho.captchaShow = false;
40 } 48 }
41 } 49 }
  50 + }
42 51
43 return req.yoho.captchaShow; 52 return req.yoho.captchaShow;
44 })().catch(function() { 53 })().catch(function() {
1 'use strict'; 1 'use strict';
2 const PAGE = 'H5'; 2 const PAGE = 'H5';
  3 +const logger = global.yoho.logger;
3 const serviceAPI = global.yoho.ServiceAPI.ApiUrl; 4 const serviceAPI = global.yoho.ServiceAPI.ApiUrl;
4 5
5 module.exports = class extends global.yoho.BaseModel { 6 module.exports = class extends global.yoho.BaseModel {
@@ -11,6 +12,7 @@ module.exports = class extends global.yoho.BaseModel { @@ -11,6 +12,7 @@ module.exports = class extends global.yoho.BaseModel {
11 * 获取图片 12 * 获取图片
12 */ 13 */
13 gen(udid) { 14 gen(udid) {
  15 + logger.info(`get verifiedGraphicCode: ${serviceAPI}passport/img-check.jpg?udid=${udid}&fromPage=${PAGE}`);
14 return Promise.resolve({ 16 return Promise.resolve({
15 code: 200, 17 code: 200,
16 data: { 18 data: {
@@ -30,6 +32,9 @@ module.exports = class extends global.yoho.BaseModel { @@ -30,6 +32,9 @@ module.exports = class extends global.yoho.BaseModel {
30 fromPage: PAGE, 32 fromPage: PAGE,
31 degrees: captcha 33 degrees: captcha
32 } 34 }
  35 + }).then(result => {
  36 + logger.info(`app.verified.graphic result: ${JSON.stringify(result)}`);
  37 + return result;
33 }); 38 });
34 } 39 }
35 }; 40 };
@@ -60,6 +60,13 @@ @@ -60,6 +60,13 @@
60 } 60 }
61 61
62 setTimeout(function() { 62 setTimeout(function() {
  63 + {{#if @root.isLogin}}
  64 + {{#if @root.isApp}}
  65 + _hmt.push(['_setCustomVar', 3, 'login', 'APP', 2]);
  66 + {{^}}
  67 + _hmt.push(['_setCustomVar', 3, 'login', 'H5', 2]);
  68 + {{/if}}
  69 + {{/if}}
63 (function() { 70 (function() {
64 var hm = document.createElement("script"); 71 var hm = document.createElement("script");
65 hm.src = "https://hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841"; 72 hm.src = "https://hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
@@ -72,14 +79,6 @@ @@ -72,14 +79,6 @@
72 var s = document.getElementsByTagName("script")[0]; 79 var s = document.getElementsByTagName("script")[0];
73 s.parentNode.insertBefore(hm, s); 80 s.parentNode.insertBefore(hm, s);
74 })(); --}} 81 })(); --}}
75 -  
76 - {{#if @root.isLogin}}  
77 - {{#if @root.isApp}}  
78 - _hmt.push(['_setCustomVar', 1, 'login', 'APP', 2]);  
79 - {{^}}  
80 - _hmt.push(['_setCustomVar', 1, 'login', 'H5', 2]);  
81 - {{/if}}  
82 - {{/if}}  
83 }, 1000); 82 }, 1000);
84 }()); 83 }());
85 84
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "6.0.21", 3 + "version": "6.0.22",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
@@ -7,6 +7,8 @@ @@ -7,6 +7,8 @@
7 require('cart/order-ensure.page.css'); 7 require('cart/order-ensure.page.css');
8 require('common.js'); 8 require('common.js');
9 9
  10 +const dialog = require('plugin/dialog');
  11 +
10 let lazyLoad = require('yoho-jquery-lazyload'), 12 let lazyLoad = require('yoho-jquery-lazyload'),
11 tip = require('plugin/tip'), 13 tip = require('plugin/tip'),
12 cookie = require('yoho-cookie'); 14 cookie = require('yoho-cookie');
@@ -262,6 +264,13 @@ function submitOrder() { @@ -262,6 +264,13 @@ function submitOrder() {
262 } 264 }
263 cookie.set('order-info', '', actCkOpthn); 265 cookie.set('order-info', '', actCkOpthn);
264 window.location.href = url; 266 window.location.href = url;
  267 + } else if (res.code === 440) {
  268 + dialog.showDialog({
  269 + dialogText: res.message,
  270 + hasFooter: {
  271 + centerBtnText: '我知道了'
  272 + }
  273 + });
265 } else if (res.message) { 274 } else if (res.message) {
266 tip.show(res.message); 275 tip.show(res.message);
267 } 276 }