Authored by shuaiguo

Merge branch 'refs/heads/develop'

... ... @@ -85,7 +85,7 @@ exports.couponSend = (req, res, next) => {
// 接口要加 session 校验,跨域异步请求未添加相关参数
if (req.yoho.isApp || app.client_type === 'miniapp') {
if (app.app_version && app.client_type && app.session_key && app.uid) {
if (app.app_version && app.client_type && app.session_key && app.uid && !req.query.webSession) {
// 小程序调接口获取 session 的方式不同,H5 嵌小程序,client_type 标记为 h5
let isMiniApp = app.client_type === 'miniapp';
... ...
... ... @@ -6,9 +6,9 @@
<div id="tab-{{@index}}" data-template-name="{{../template_name}}" data-tab-name="{{tab_name}}" data-template-id="{{../template_id}}" data-index="{{@index}}" data-index-idx="{{@index}}" data-item-idx="{{@index}}" class="guess-tab first" data-query="{{queryString}}" data-code="{{resources_code}}">
{{#if src}}
<img class="guess-img" src="{{image2 src w=200 h=160 q=60 mode=3}}" />
<div class=""></div>
<div class="guess-tab-active"></div>
{{else}}
<span class="guess-like-tab">{{tab_name}}</span>
<span class="guess-like-tab guess-like-tab-active">{{tab_name}}</span>
{{/if}}
</div>
{{^}}
... ...
... ... @@ -25,7 +25,11 @@ const geetest = {
} else {
req.session.useYohoCaptcha = true;
}
if (req.query.callback) {
res.jsonp(data);
} else {
res.send(data);
}
}).catch(next);
},
validate(req, res, next) {
... ...
... ... @@ -89,7 +89,11 @@ class SmsLogin {
co(function* () {
let sendSmsResult = yield req.ctx(PhoneServiceModel).sendSMS(params);
if (req.query.callback) {
res.jsonp(sendSmsResult);
} else {
res.json(sendSmsResult);
}
})().catch(next);
}
... ... @@ -159,8 +163,14 @@ class SmsLogin {
let shopping_key = cookie.getShoppingKey(req); // eslint-disable-line
let from = req.cookies.from || 'yohobuy';
if (req.query.callback) {
res._sendFn = res.jsonp;
} else {
res._sendFn = res.json;
}
if (!mobile || !area) {
res.json({
res._sendFn({
code: 401,
message: VERIFY_ERROR
});
... ... @@ -171,13 +181,13 @@ class SmsLogin {
// 验证码 校验异常
if (r2.code !== 200) {
res.json(r2);
res._sendFn(r2);
return;
}
// 校验失败
if (r2.data.is_pass !== 'Y') {
res.json({
res._sendFn({
code: 401,
message: '短信验证码错误'
});
... ... @@ -218,7 +228,7 @@ class SmsLogin {
});
return req.ctx(AuthHelperModel).syncUserSession(info.data.uid, req, res, info.data.session_key);
}).then((authData) => {
res.json({
res._sendFn({
code: 200,
message: LOGIN_SUCCSS,
redirect: _.get(authData, 'refer') || utils.refererLimit(req.cookies.refer),
... ... @@ -228,7 +238,7 @@ class SmsLogin {
delete req.session.smsLogin;
}).catch(error => {
res.json(error);
res._sendFn(error);
});
}).catch(next);
}
... ...
... ... @@ -169,6 +169,15 @@ router.get('/passport/sms_login',
validateCode.load,
smsLogin.smsLoginPage); // 短信验证码登录
router.post('/passport/sms_login/step1_check', validateCode.check, smsLogin.indexCheck);
router.get('/passport/sms_login/step1_check', (req, res, next) => {
if (!req.query.callback) {
return res.json({code: 400});
}
req.body = req.body || {};
Object.assign(req.body, req.query);
next();
}, validateCode.check, smsLogin.indexCheck);
// 兼容老的路由
router.get('/signin.html',
... ...
... ... @@ -7,7 +7,8 @@ const config = global.yoho.config;
module.exports = () => {
return (req, res, next) => {
if (!req.yoho.isApp) {
// webSession: 活动模板手机号领券,使用web端登录信息
if (!req.yoho.isApp || req.query.webSession) {
// 从 SESSION 中获取到当前登录用户的 UID
if (req.session && _.isNumber(req.session.LOGIN_UID_)) {
// 调用接口传参时切勿使用toString获得字符串
... ...
{
"name": "yohobuywap-node",
"version": "6.11.1",
"version": "6.12.0",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -70,8 +70,12 @@ class ResourceShowYasRpter {
let cacheTheShowSkns = []; // 暂存此次上报的楼层,上报后复制给 lastReportSkns
let tabParams = {};
let $tapDom = $('.guess-like-tab-active');
$tapDom = $tapDom.length ? $tapDom.parent() : $('.guess-tab-active').parent();
tabParams.TAB_NAME = $('.guess-like-tab-active').parent().data('tab-name') || $('.guess-tab-active').parent().data('tab-name');
tabParams.TAB_ID = $('.guess-like-tab-active').parent().data('item-idx') + 1 || $('.guess-tab-active').parent().data('item-idx') + 1;
tabParams.TAB_ID = $tapDom.data('item-idx');
tabParams.P_PARAM = $('.guess-like-tab-active').parent().data('code') || $('.guess-tab-active').parent().data('code');
$('.templates').each((floorIndex, theFloor) => {
... ...
... ... @@ -380,7 +380,7 @@ class Group extends Page {
let tabName = $this.data('tab-name');
let params = {
TAB_ID: itemIdx + 1,
TAB_ID: itemIdx,
TAB_NAME: tabName || '',
...custom_params
};
... ... @@ -406,7 +406,7 @@ class Group extends Page {
F_INDEX: indexIdx + 1,
I_INDEX: itemIdx + 1,
ACTION_URL: '', // 拼团不传
TAB_ID: this.tabId + 1,
TAB_ID: this.tabId,
TAB_NAME: this.tabName,
P_PARAM: this.contentCode,
...custom_params
... ...
... ... @@ -91,8 +91,8 @@ module.exports = (list) => {
item.vip1_price && (item.vip1_price = item.vip1_price.toFixed(2));
item.vip2_price && (item.vip2_price = item.vip2_price.toFixed(2));
item.vip3_price && (item.vip3_price = item.vip3_price.toFixed(2));
item.sales_price && (item.sales_price = item.sales_price.toFixed(2));
item.market_price && (item.market_price = item.market_price.toFixed(2));
item.sales_price && (item.sales_price = String(item.sales_price));
item.market_price && (item.market_price = String(item.market_price));
}
}
... ...