Authored by 陈峰

Merge branch 'hotfix/bugs' into 'master'

Hotfix/bugs



See merge request !398
@@ -55,7 +55,9 @@ module.exports = { @@ -55,7 +55,9 @@ module.exports = {
55 cache: true 55 cache: true
56 }); 56 });
57 } 57 }
58 - 58 + if (!data) {
  59 + return;
  60 + }
59 data = data.data; 61 data = data.data;
60 if (data && data.floors) { 62 if (data && data.floors) {
61 data.floors.forEach(function(f) { 63 data.floors.forEach(function(f) {
@@ -31,7 +31,7 @@ module.exports = { @@ -31,7 +31,7 @@ module.exports = {
31 cache: true 31 cache: true
32 }).then(res => { 32 }).then(res => {
33 var data = [], 33 var data = [],
34 - lst = (res.data && res.data.product_list) || []; 34 + lst = (res && res.data && res.data.product_list) || [];
35 35
36 lst.forEach(function(o) { 36 lst.forEach(function(o) {
37 o && data.push(_getProduct(o)); 37 o && data.push(_getProduct(o));
1 'use strict'; 1 'use strict';
  2 +const _ = require('lodash');
2 3
3 const model = require('../models/myqrcode'), 4 const model = require('../models/myqrcode'),
4 headerModel = require('../../../doraemon/models/header'); // 头部model 5 headerModel = require('../../../doraemon/models/header'); // 头部model
@@ -6,9 +7,10 @@ const model = require('../models/myqrcode'), @@ -6,9 +7,10 @@ const model = require('../models/myqrcode'),
6 exports.index = (req, res, next) => { 7 exports.index = (req, res, next) => {
7 let params = req.query, 8 let params = req.query,
8 esc = false, 9 esc = false,
9 - appversion = req.query.app_version || ''; 10 + appversion = _.isArray(req.query.app_version) ? req.query.app_version[0] : req.query.app_version || '';
10 11
11 - if (Number(appversion.substr(0, 1) < 5) || (Number(appversion.substr(0, 1)) === 5 && Number(appversion.substr(2, 1)) < 2)) { 12 + if (Number(appversion.substr(0, 1) < 5) ||
  13 + (Number(appversion.substr(0, 1)) === 5 && Number(appversion.substr(2, 1)) < 2)) {
12 esc = true; 14 esc = true;
13 } 15 }
14 let uname; 16 let uname;
@@ -213,7 +213,7 @@ const sendCodeToMobileAPI = (req, res, next) => { @@ -213,7 +213,7 @@ const sendCodeToMobileAPI = (req, res, next) => {
213 213
214 logger.info(`captcha validate result${verifyCode.toString() === captcha},user:${verifyCode};server:${captcha}`); 214 logger.info(`captcha validate result${verifyCode.toString() === captcha},user:${verifyCode};server:${captcha}`);
215 if ((captcha && verifyCode.toString() === captcha) || (testCode === config.testCode)) { 215 if ((captcha && verifyCode.toString() === captcha) || (testCode === config.testCode)) {
216 - req.session.backupCaptch.verifyResult = true; 216 + _.set(req.session, 'backupCaptch.verifyResult', true);
217 } else { 217 } else {
218 let jsonData = { 218 let jsonData = {
219 code: 400, 219 code: 400,
@@ -432,16 +432,23 @@ exports.password = (req, res, next) => { @@ -432,16 +432,23 @@ exports.password = (req, res, next) => {
432 let shoppingKey = cookie.getShoppingKey(req); 432 let shoppingKey = cookie.getShoppingKey(req);
433 433
434 434
  435 + // 验证注册的标识码是否有效
  436 + let resultCopy = null;
  437 +
435 RegService.regMobileAes(area, mobile, password, shoppingKey, registerCode).then(result => { 438 RegService.regMobileAes(area, mobile, password, shoppingKey, registerCode).then(result => {
436 if (!result.code || result.code !== 200) { 439 if (!result.code || result.code !== 200) {
437 - return Promise.reject(result); 440 + return res.send(result);
438 } 441 }
439 if (!result.data || !result.data.uid) { 442 if (!result.data || !result.data.uid) {
440 - return Promise.reject(result); 443 + return res.send(result);
441 } 444 }
  445 + resultCopy = result;
442 446
443 return AuthHelper.syncUserSession(result.data.uid, req, res); 447 return AuthHelper.syncUserSession(result.data.uid, req, res);
444 }).then(() => { 448 }).then(() => {
  449 + if (!resultCopy) {
  450 + return;
  451 + }
445 res.json({ 452 res.json({
446 code: 200, 453 code: 200,
447 message: LOGIN_SUCCSS, 454 message: LOGIN_SUCCSS,
@@ -14,6 +14,9 @@ const bundleModel = require(`${mRoot}/bundle`); @@ -14,6 +14,9 @@ const bundleModel = require(`${mRoot}/bundle`);
14 */ 14 */
15 exports.detail = (req, res, next) => { 15 exports.detail = (req, res, next) => {
16 bundleModel.detail(req.query, req.yoho.isApp).then(result => { 16 bundleModel.detail(req.query, req.yoho.isApp).then(result => {
  17 + if (!result.bundleDatas) {
  18 + return next();
  19 + }
17 if (result.bundleDatas.length <= 3) { 20 if (result.bundleDatas.length <= 3) {
18 result.any = true; 21 result.any = true;
19 } 22 }
@@ -96,6 +96,10 @@ const _processClassNames = (list) => { @@ -96,6 +96,10 @@ const _processClassNames = (list) => {
96 const _searchGoods = (params) => { 96 const _searchGoods = (params) => {
97 let method = 'app.search.li'; 97 let method = 'app.search.li';
98 98
  99 + if (_.isArray(params.query)) {
  100 + params.query = _.join(params.query, ',');
  101 + }
  102 +
99 // 排除基本筛选项默认值为0的对象 103 // 排除基本筛选项默认值为0的对象
100 for (let str in params) { 104 for (let str in params) {
101 if (str !== 'order' && params[str] === '0' || params[str] === null) { 105 if (str !== 'order' && params[str] === '0' || params[str] === null) {
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "5.5.1", 3 + "version": "5.5.2",
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": {
@@ -120,6 +120,7 @@ $loginBtn.on('touchstart', function() { @@ -120,6 +120,7 @@ $loginBtn.on('touchstart', function() {
120 success: function(data) { 120 success: function(data) {
121 var res; 121 var res;
122 122
  123 + validate.type === 2 && validate.refresh();
123 if (data.code === 200) { 124 if (data.code === 200) {
124 res = data.data; 125 res = data.data;
125 showErrTip('登录成功'); 126 showErrTip('登录成功');
@@ -129,11 +130,11 @@ $loginBtn.on('touchstart', function() { @@ -129,11 +130,11 @@ $loginBtn.on('touchstart', function() {
129 location.href = res.href; 130 location.href = res.href;
130 }, 1500); 131 }, 1500);
131 132
132 - $loginBtn.text('登录成功').off(); 133 + $loginBtn.text('登录成功');
133 showErrTip('登录成功'); 134 showErrTip('登录成功');
134 } else { 135 } else {
135 if (data.captchaShow) { 136 if (data.captchaShow) {
136 - validate.atWorking ? ((data.changeCaptcha || validate.type === 2) && validate.refresh()) : validate.init(); 137 + validate.atWorking ? ((data.changeCaptcha || validate.type !== 2) && validate.refresh()) : validate.init();
137 } 138 }
138 139
139 showErrTip(data.message); 140 showErrTip(data.message);
@@ -141,16 +141,16 @@ $loginBtn.on('touchstart', function() { @@ -141,16 +141,16 @@ $loginBtn.on('touchstart', function() {
141 }) 141 })
142 }, true); 142 }, true);
143 } 143 }
144 - 144 + validate.type === 2 && validate.refresh();
145 if (data.code === 200) { 145 if (data.code === 200) {
146 res = data.data; 146 res = data.data;
147 147
148 showErrTip('登录成功'); 148 showErrTip('登录成功');
149 location.href = res.href; 149 location.href = res.href;
150 - $loginBtn.text('登录成功').off(); 150 + $loginBtn.text('登录成功');
151 } else { 151 } else {
152 if (data.captchaShow) { 152 if (data.captchaShow) {
153 - validate.atWorking ? ((data.changeCaptcha || validate.type === 2) && validate.refresh()) : validate.init(); 153 + validate.atWorking ? ((data.changeCaptcha || validate.type !== 2) && validate.refresh()) : validate.init();
154 } 154 }
155 155
156 showErrTip(data.message); 156 showErrTip(data.message);
@@ -131,7 +131,7 @@ page = { @@ -131,7 +131,7 @@ page = {
131 .done(function(data) { 131 .done(function(data) {
132 if (data.code === 200) { 132 if (data.code === 200) {
133 checkPoint('YB_MOBILE_NEXT_C'); // 埋点 133 checkPoint('YB_MOBILE_NEXT_C'); // 埋点
134 - $nextBtn.off(); 134 + // $nextBtn.off();
135 location.href = data.redirect; 135 location.href = data.redirect;
136 } else { 136 } else {
137 data.changeCaptcha && imgCheck.refresh(); 137 data.changeCaptcha && imgCheck.refresh();
@@ -87,7 +87,7 @@ page = { @@ -87,7 +87,7 @@ page = {
87 .done(function(res) { 87 .done(function(res) {
88 if (res.code === 200) { 88 if (res.code === 200) {
89 checkPoint('YB_SET_PASSWORD_ENSURE_C'); // 埋点 89 checkPoint('YB_SET_PASSWORD_ENSURE_C'); // 埋点
90 - $nextBtn.off(); 90 + // $nextBtn.off();
91 location.href = res.redirect; 91 location.href = res.redirect;
92 return; 92 return;
93 } 93 }
@@ -10,6 +10,13 @@ const validType = { @@ -10,6 +10,13 @@ const validType = {
10 GEETEST: 2 10 GEETEST: 2
11 }; 11 };
12 12
  13 +// 解决加载w3t统计代码同时使用geetest报错问题
  14 +(() => {
  15 + (typeof SVGAnimatedString !== 'undefined') && (SVGAnimatedString.prototype.indexOf = function() {
  16 + return false;
  17 + });
  18 +})();
  19 +
13 class Validate { 20 class Validate {
14 constructor(container, options) { 21 constructor(container, options) {
15 this.$container = container; 22 this.$container = container;
@@ -204,13 +204,14 @@ exports.processProductList = (list, options) => { @@ -204,13 +204,14 @@ exports.processProductList = (list, options) => {
204 */ 204 */
205 exports.termsSuggestion = (list, options) => { 205 exports.termsSuggestion = (list, options) => {
206 let termsSuggestion = []; 206 let termsSuggestion = [];
  207 + let query = options.query && decodeURIComponent(options.query.replace(/\%/g, escape('%'))) || '';
207 208
208 _.each(list, (terms, index) => { 209 _.each(list, (terms, index) => {
209 termsSuggestion.push({ 210 termsSuggestion.push({
210 name: terms, 211 name: terms,
211 link: helpers.urlFormat('/', {needSuggestion: 'Y', query: terms, from: 'search'}, 'search'), 212 link: helpers.urlFormat('/', {needSuggestion: 'Y', query: terms, from: 'search'}, 'search'),
212 select: (options.isChangedQuery && index === 0) || 213 select: (options.isChangedQuery && index === 0) ||
213 - (options.needSuggestion === 'Y' && terms === decodeURIComponent(options.query)) 214 + (options.needSuggestion === 'Y' && terms === query)
214 }); 215 });
215 }); 216 });
216 217