Authored by 郭成尧

Merge branch 'master' into feature/passback

... ... @@ -20,7 +20,7 @@ exports.cartPayAPI = (params) => {
method: params.activityInfo ? 'app.Shopping.easyPayment' : 'app.Shopping.payment',
enable_red_envelopes: 0, // h5不返回红包
cart_type: params.cart_type,
yoho_coin_mode: params.yoho_coin_mode,
yoho_coin_mode: params.yoho_coin_mode || 0,
uid: params.uid
};
... ...
... ... @@ -129,9 +129,9 @@
</a>
</div>
<div class="group-list">
<a class="list-item invite" href="http://activity.yoho.cn/feature/623.html?share_id=2795&title=邀请好友100元现金券无限赚">
<a class="list-item invite" href="https://activity.yoho.cn/feature/357.html?share_id=2391&title=邀请好友50元现金券无限赚">
<span class="horn"></span>
邀请好友,100元礼券无限赚!
邀请好友,50元现金券无限赚!
<span class="iconfont num">&#xe604;</span>
</a>
<a class="list-item message" href="/home/message">
... ...
... ... @@ -266,7 +266,7 @@ const local = {
captchaShow: true
};
cache.set(`loginErrorIp:${req.yoho.clientIp}`, true, 3600).catch(log.error);
cache.set(`loginErrorIp:${req.yoho.clientIp}`, true, 3600 * 24).catch(log.error);
return res.json(obj);
}
} else {
... ... @@ -491,19 +491,29 @@ exports.loginShowCaptchaByIp = function(req, res, next) {
req.yoho.captchaShow = false;
}
co(function*() {
let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`);
// 第一次登录要不要展示验证码:后台开关勾选,首次登录不需要展示
let firstLoginShowCaptcha = !_.get(req.app.locals.wap, 'close.firstLoginShowCaptcha', false);
log.info(`Pagerender clientip ${req.yoho.clientIp} status is ` + hasErrorLog);
log.info(`firstLoginShowCaptcha status is ${firstLoginShowCaptcha}`);
if (hasErrorLog) {
req.yoho.captchaShow = true;
}
next();
})().catch(function(e) {
if (firstLoginShowCaptcha) {
req.yoho.captchaShow = true;
next();
});
return next();
} else {
co(function* () {
let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`);
log.info(`Pagerender clientip ${req.yoho.clientIp} status is ` + hasErrorLog);
if (hasErrorLog) {
req.yoho.captchaShow = true;
}
next();
})().catch(function(e) {
req.yoho.captchaShow = true;
next();
});
}
};
exports.common = common;
... ...
... ... @@ -29,14 +29,23 @@ const check = (req, res, next) => {
co(function* () {
// 如果是账号密码登录,那么需要检查是否登录失败过,登录失败过展示验证码
if (req.path === '/passport/login/auth') {
let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`);
// 第一次登录要不要展示验证码:后台开关勾选,首次登录不需要展示
let firstLoginShowCaptcha = !_.get(req.app.locals.wap, 'close.firstLoginShowCaptcha', false);
log.info(`Check clientip ${req.yoho.clientIp} status is ` + hasErrorLog);
log.info(`firstLoginShowCaptcha status is ${firstLoginShowCaptcha}`);
if (hasErrorLog) {
if (firstLoginShowCaptcha) {
req.yoho.captchaShow = true;
} else {
req.yoho.captchaShow = false;
let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`);
log.info(`Check clientip ${req.yoho.clientIp} status is ` + hasErrorLog);
if (hasErrorLog) {
req.yoho.captchaShow = true;
} else {
req.yoho.captchaShow = false;
}
}
}
... ...
'use strict';
const PAGE = 'H5';
const logger = global.yoho.logger;
const serviceAPI = global.yoho.ServiceAPI.ApiUrl;
module.exports = class extends global.yoho.BaseModel {
... ... @@ -11,6 +12,7 @@ module.exports = class extends global.yoho.BaseModel {
* 获取图片
*/
gen(udid) {
logger.info(`get verifiedGraphicCode: ${serviceAPI}passport/img-check.jpg?udid=${udid}&fromPage=${PAGE}`);
return Promise.resolve({
code: 200,
data: {
... ... @@ -30,6 +32,9 @@ module.exports = class extends global.yoho.BaseModel {
fromPage: PAGE,
degrees: captcha
}
}).then(result => {
logger.info(`app.verified.graphic result: ${JSON.stringify(result)}`);
return result;
});
}
};
... ...
... ... @@ -60,6 +60,13 @@
}
setTimeout(function() {
{{#if @root.isLogin}}
{{#if @root.isApp}}
_hmt.push(['_setCustomVar', 3, 'login', 'APP', 2]);
{{^}}
_hmt.push(['_setCustomVar', 3, 'login', 'H5', 2]);
{{/if}}
{{/if}}
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
... ... @@ -72,14 +79,6 @@
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})(); --}}
{{#if @root.isLogin}}
{{#if @root.isApp}}
_hmt.push(['_setCustomVar', 1, 'login', 'APP', 2]);
{{^}}
_hmt.push(['_setCustomVar', 1, 'login', 'H5', 2]);
{{/if}}
{{/if}}
}, 1000);
}());
... ...
{
"name": "m-yohobuy-node",
"version": "6.0.21",
"version": "6.0.22",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -7,6 +7,8 @@
require('cart/order-ensure.page.css');
require('common.js');
const dialog = require('plugin/dialog');
let lazyLoad = require('yoho-jquery-lazyload'),
tip = require('plugin/tip'),
cookie = require('yoho-cookie');
... ... @@ -262,6 +264,13 @@ function submitOrder() {
}
cookie.set('order-info', '', actCkOpthn);
window.location.href = url;
} else if (res.code === 440) {
dialog.showDialog({
dialogText: res.message,
hasFooter: {
centerBtnText: '我知道了'
}
});
} else if (res.message) {
tip.show(res.message);
}
... ...
... ... @@ -31,7 +31,7 @@
margin: 0 auto;
border-radius: 10px;
}
.world-number {
position: absolute;
font-size: 24px;
... ...