Merge branch 'hotfix/error' into gray
Showing
12 changed files
with
38 additions
and
38 deletions
@@ -76,6 +76,8 @@ const getBrandByChannel = (channel) => { | @@ -76,6 +76,8 @@ const getBrandByChannel = (channel) => { | ||
76 | }; | 76 | }; |
77 | break; | 77 | break; |
78 | default: | 78 | default: |
79 | + channel = 1; | ||
80 | + break; | ||
79 | } | 81 | } |
80 | 82 | ||
81 | return _packageAd(params).then(result => { | 83 | return _packageAd(params).then(result => { |
@@ -10,7 +10,6 @@ const optModel = require(`${mRoot}/opt`); | @@ -10,7 +10,6 @@ const optModel = require(`${mRoot}/opt`); | ||
10 | const brandModel = require(`${mRoot}/brand`); | 10 | const brandModel = require(`${mRoot}/brand`); |
11 | const helpers = global.yoho.helpers; | 11 | const helpers = global.yoho.helpers; |
12 | const stringProcess = require(`${global.utils}/string-process`); | 12 | const stringProcess = require(`${global.utils}/string-process`); |
13 | -const crypto = global.yoho.crypto; | ||
14 | const _ = require('lodash'); | 13 | const _ = require('lodash'); |
15 | 14 | ||
16 | /** | 15 | /** |
@@ -113,7 +112,7 @@ const favoriteBrand = (req, res, next) => { | @@ -113,7 +112,7 @@ const favoriteBrand = (req, res, next) => { | ||
113 | /* 判断参数是否有效 */ | 112 | /* 判断参数是否有效 */ |
114 | let id = req.body.id, | 113 | let id = req.body.id, |
115 | opt = req.body.opt || 'ok', | 114 | opt = req.body.opt || 'ok', |
116 | - uid = req.user.uid || (req.body.uid && parseInt(crypto.decrypt(null, req.body.uid))) || req.cookies.appUid, | 115 | + uid = req.user.uid || (req.body.uid && parseInt(req.body.uid, 10)) || req.cookies.appUid, |
117 | isBrand = req.body.isBrand; | 116 | isBrand = req.body.isBrand; |
118 | 117 | ||
119 | if (!stringProcess.isNumeric(id) || !stringProcess.isNumeric(uid)) { | 118 | if (!stringProcess.isNumeric(id) || !stringProcess.isNumeric(uid)) { |
@@ -6,12 +6,9 @@ | @@ -6,12 +6,9 @@ | ||
6 | 'use strict'; | 6 | 'use strict'; |
7 | 7 | ||
8 | const mRoot = '../models'; | 8 | const mRoot = '../models'; |
9 | -const express = require('express'); | ||
10 | -const app = express(); | ||
11 | const plustarModel = require(`${mRoot}/plustar`); | 9 | const plustarModel = require(`${mRoot}/plustar`); |
12 | const htmlProcess = require(`${global.utils}/html-process`); | 10 | const htmlProcess = require(`${global.utils}/html-process`); |
13 | const headerModel = require('../../../doraemon/models/header'); // 头部model | 11 | const headerModel = require('../../../doraemon/models/header'); // 头部model |
14 | -const crypto = global.yoho.crypto; | ||
15 | const _ = require('lodash'); | 12 | const _ = require('lodash'); |
16 | 13 | ||
17 | let channels = { | 14 | let channels = { |
@@ -93,7 +90,7 @@ const getDetailData = (req, res, next) => { | @@ -93,7 +90,7 @@ const getDetailData = (req, res, next) => { | ||
93 | 90 | ||
94 | if (isApp) { | 91 | if (isApp) { |
95 | if (req.query.uid) { | 92 | if (req.query.uid) { |
96 | - uid = crypto.encryption('', req.query.uid + ''); | 93 | + uid = req.query.uid; |
97 | } | 94 | } |
98 | } else { | 95 | } else { |
99 | uid = req.user.uid; | 96 | uid = req.user.uid; |
@@ -140,7 +137,7 @@ const getDetailData = (req, res, next) => { | @@ -140,7 +137,7 @@ const getDetailData = (req, res, next) => { | ||
140 | * [品牌详情异步数据] | 137 | * [品牌详情异步数据] |
141 | */ | 138 | */ |
142 | const getDetailDataAsync = (req, res, next) => { | 139 | const getDetailDataAsync = (req, res, next) => { |
143 | - let uid = req.user.uid; | 140 | + let uid; |
144 | let udid = req.sessionID || 'yoho'; | 141 | let udid = req.sessionID || 'yoho'; |
145 | let clientType = req.body.client_type || ''; | 142 | let clientType = req.body.client_type || ''; |
146 | let brandId = req.body.brand_id || 0; | 143 | let brandId = req.body.brand_id || 0; |
@@ -148,8 +145,10 @@ const getDetailDataAsync = (req, res, next) => { | @@ -148,8 +145,10 @@ const getDetailDataAsync = (req, res, next) => { | ||
148 | 145 | ||
149 | if (isApp) { | 146 | if (isApp) { |
150 | if (req.body.uid) { | 147 | if (req.body.uid) { |
151 | - uid = parseInt(crypto.decrypt(null, req.body.uid)); | 148 | + uid = parseInt(req.body.uid, 10); |
152 | } | 149 | } |
150 | + } else { | ||
151 | + uid = parseInt(req.user.uid, 10); | ||
153 | } | 152 | } |
154 | 153 | ||
155 | if (!brandId) { | 154 | if (!brandId) { |
@@ -160,7 +159,7 @@ const getDetailDataAsync = (req, res, next) => { | @@ -160,7 +159,7 @@ const getDetailDataAsync = (req, res, next) => { | ||
160 | isLike: result.isLike, | 159 | isLike: result.isLike, |
161 | infos: result.infos | 160 | infos: result.infos |
162 | }); | 161 | }); |
163 | - }); | 162 | + }).catch(next); |
164 | }; | 163 | }; |
165 | 164 | ||
166 | module.exports = { | 165 | module.exports = { |
@@ -7,7 +7,6 @@ const _ = require('lodash'); | @@ -7,7 +7,6 @@ const _ = require('lodash'); | ||
7 | const logger = global.yoho.logger; | 7 | const logger = global.yoho.logger; |
8 | const helpers = global.yoho.helpers; | 8 | const helpers = global.yoho.helpers; |
9 | const htmlProcess = require(`${global.utils}/html-process`); | 9 | const htmlProcess = require(`${global.utils}/html-process`); |
10 | -const crypto = global.yoho.crypto; | ||
11 | const imageProcess = require(`${global.utils}/image`); | 10 | const imageProcess = require(`${global.utils}/image`); |
12 | 11 | ||
13 | const privateKeyList = { | 12 | const privateKeyList = { |
@@ -314,7 +313,7 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { | @@ -314,7 +313,7 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { | ||
314 | 313 | ||
315 | if (isApp) { | 314 | if (isApp) { |
316 | url = '?openby:yohobuy={"action":"go.brand","params":{"brand_id":"' + brandId + '","is_different":"' + isDifferent + '"}}'; | 315 | url = '?openby:yohobuy={"action":"go.brand","params":{"brand_id":"' + brandId + '","is_different":"' + isDifferent + '"}}'; |
317 | - uid = parseInt(crypto.decrypt(null, uid)); | 316 | + uid = parseInt(uid, 10); |
318 | } else { | 317 | } else { |
319 | url = '//' + brandDomain + '.m.yohobuy.com'; | 318 | url = '//' + brandDomain + '.m.yohobuy.com'; |
320 | } | 319 | } |
@@ -8,8 +8,8 @@ exports.get = (req, res, next) => { | @@ -8,8 +8,8 @@ exports.get = (req, res, next) => { | ||
8 | }; | 8 | }; |
9 | 9 | ||
10 | return imgCheckAPI.gen().then(result => { | 10 | return imgCheckAPI.gen().then(result => { |
11 | - if (result.code === 200) { | ||
12 | - let codeStr = result.data.degrees.reduce((str, rotate) => { | 11 | + if (result.code === 200 && result.data) { |
12 | + let codeStr = result.data.degrees.reduce((str, rotate) => { | ||
13 | return str.concat((4 - rotate / 90 % 4) % 4); | 13 | return str.concat((4 - rotate / 90 % 4) % 4); |
14 | }, ''); | 14 | }, ''); |
15 | 15 |
@@ -285,7 +285,7 @@ const wechat = { | @@ -285,7 +285,7 @@ const wechat = { | ||
285 | doPassportCallback(openId, nickname, 'wechat', req, res).catch(next); | 285 | doPassportCallback(openId, nickname, 'wechat', req, res).catch(next); |
286 | })(req, res, next); | 286 | })(req, res, next); |
287 | } else { | 287 | } else { |
288 | - return next(new Error('Auth State Mismatch')); | 288 | + return next('Auth State Mismatch'); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | }; | 291 | }; |
@@ -310,7 +310,7 @@ const sina = { | @@ -310,7 +310,7 @@ const sina = { | ||
310 | doPassportCallback(openId, nickname, 'sina', req, res).catch(next); | 310 | doPassportCallback(openId, nickname, 'sina', req, res).catch(next); |
311 | })(req, res, next); | 311 | })(req, res, next); |
312 | } else { | 312 | } else { |
313 | - return next(new Error('Auth State Mismatch')); | 313 | + return next('Auth State Mismatch'); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | }; | 316 | }; |
@@ -20,7 +20,7 @@ const list = (req, res, next) => { | @@ -20,7 +20,7 @@ const list = (req, res, next) => { | ||
20 | cartUrl: helpers.urlFormat('/cart/index/index') | 20 | cartUrl: helpers.urlFormat('/cart/index/index') |
21 | }, req.query); | 21 | }, req.query); |
22 | let title = ''; | 22 | let title = ''; |
23 | - let query = req.query.query ? decodeURIComponent(req.query.query) : ''; | 23 | + let query = req.query.query; |
24 | let isQueryFirstClass = false; // 标识用户搜的是不是一级品类 | 24 | let isQueryFirstClass = false; // 标识用户搜的是不是一级品类 |
25 | let isQuerySecondClass = false; // 标识用户搜的是不是二级品类 | 25 | let isQuerySecondClass = false; // 标识用户搜的是不是二级品类 |
26 | let domain = null; | 26 | let domain = null; |
@@ -145,7 +145,7 @@ let _getShopsInfo = (brandId) => { | @@ -145,7 +145,7 @@ let _getShopsInfo = (brandId) => { | ||
145 | }, { | 145 | }, { |
146 | cache: true | 146 | cache: true |
147 | }).then(shops => { | 147 | }).then(shops => { |
148 | - if (shops.code === 200) { | 148 | + if (shops && shops.code === 200) { |
149 | return _processShopsInfo(shops.data); | 149 | return _processShopsInfo(shops.data); |
150 | } | 150 | } |
151 | 151 | ||
@@ -160,7 +160,7 @@ let _getPromotionInfo = (skn) => { | @@ -160,7 +160,7 @@ let _getPromotionInfo = (skn) => { | ||
160 | }, { | 160 | }, { |
161 | cache: true | 161 | cache: true |
162 | }).then((result) => { | 162 | }).then((result) => { |
163 | - if (result.code === 200) { | 163 | + if (result && result.code === 200) { |
164 | return result.data; | 164 | return result.data; |
165 | } | 165 | } |
166 | 166 | ||
@@ -180,7 +180,7 @@ let _getFavorite = (productId, uid) => { | @@ -180,7 +180,7 @@ let _getFavorite = (productId, uid) => { | ||
180 | uid: uid, | 180 | uid: uid, |
181 | id: productId | 181 | id: productId |
182 | }).then((result) => { | 182 | }).then((result) => { |
183 | - if (result.code === 200) { | 183 | + if (result && result.code === 200) { |
184 | return result.data; | 184 | return result.data; |
185 | } | 185 | } |
186 | 186 | ||
@@ -211,7 +211,7 @@ let getProductData = (data) => { | @@ -211,7 +211,7 @@ let getProductData = (data) => { | ||
211 | code: 200, | 211 | code: 200, |
212 | cache: true | 212 | cache: true |
213 | }).then(result => { | 213 | }).then(result => { |
214 | - if (result.code === 500 || !result.data) { | 214 | + if (!result || result.code === 500 || !result.data) { |
215 | return {}; | 215 | return {}; |
216 | } | 216 | } |
217 | result = result.data; | 217 | result = result.data; |
@@ -418,7 +418,7 @@ const _cartCount = (uid, shoppingKey) => { | @@ -418,7 +418,7 @@ const _cartCount = (uid, shoppingKey) => { | ||
418 | uid: uid, | 418 | uid: uid, |
419 | shopping_key: shoppingKey | 419 | shopping_key: shoppingKey |
420 | }).then((result) => { | 420 | }).then((result) => { |
421 | - if (result.code === 200) { | 421 | + if (result && result.code === 200) { |
422 | var count = result.data.cart_goods_count || 0; | 422 | var count = result.data.cart_goods_count || 0; |
423 | 423 | ||
424 | if (count > 99) { | 424 | if (count > 99) { |
@@ -464,7 +464,7 @@ let getNewProductAsyncData = (data) => { | @@ -464,7 +464,7 @@ let getNewProductAsyncData = (data) => { | ||
464 | code: 200, | 464 | code: 200, |
465 | cache: true | 465 | cache: true |
466 | }).then(result => { | 466 | }).then(result => { |
467 | - if (result.code === 500 || !result.data) { | 467 | + if (!result || result.code === 500 || !result.data) { |
468 | return {}; | 468 | return {}; |
469 | } | 469 | } |
470 | result = result.data; | 470 | result = result.data; |
@@ -556,7 +556,7 @@ let getProductAsyncData = (data) => { | @@ -556,7 +556,7 @@ let getProductAsyncData = (data) => { | ||
556 | code: 200, | 556 | code: 200, |
557 | cache: true | 557 | cache: true |
558 | }).then(result => { | 558 | }).then(result => { |
559 | - if (result.code === 500 || !result.data) { | 559 | + if (!result || result.code === 500 || !result.data) { |
560 | return {}; | 560 | return {}; |
561 | } | 561 | } |
562 | result = result.data; | 562 | result = result.data; |
@@ -117,7 +117,7 @@ const _getShopInfo = (shopId, uid) => { | @@ -117,7 +117,7 @@ const _getShopInfo = (shopId, uid) => { | ||
117 | shop_id: shopId, | 117 | shop_id: shopId, |
118 | uid: uid || 0 | 118 | uid: uid || 0 |
119 | }, {code: 200}).then((result) => { | 119 | }, {code: 200}).then((result) => { |
120 | - return result.data; | 120 | + return result && result.data; |
121 | }); | 121 | }); |
122 | }; | 122 | }; |
123 | 123 | ||
@@ -131,7 +131,7 @@ const getShopIntro = (shopId, uid) => { | @@ -131,7 +131,7 @@ const getShopIntro = (shopId, uid) => { | ||
131 | shop_id: shopId, | 131 | shop_id: shopId, |
132 | uid: uid | 132 | uid: uid |
133 | }, {code: 200}).then(result => { | 133 | }, {code: 200}).then(result => { |
134 | - return result.data; | 134 | + return result && result.data; |
135 | }); | 135 | }); |
136 | }; | 136 | }; |
137 | 137 | ||
@@ -148,7 +148,7 @@ const _getShopCategory = (shopId, channel, gender) => { | @@ -148,7 +148,7 @@ const _getShopCategory = (shopId, channel, gender) => { | ||
148 | gender: gender || '1,3', | 148 | gender: gender || '1,3', |
149 | shop_id: shopId | 149 | shop_id: shopId |
150 | }, {code: 200, cache: true}).then(result => { | 150 | }, {code: 200, cache: true}).then(result => { |
151 | - return result.data; | 151 | + return result && result.data; |
152 | }); | 152 | }); |
153 | }; | 153 | }; |
154 | 154 | ||
@@ -711,7 +711,7 @@ const getBrandBanner = (brandId) => { | @@ -711,7 +711,7 @@ const getBrandBanner = (brandId) => { | ||
711 | }, { | 711 | }, { |
712 | cache: true | 712 | cache: true |
713 | }).then((result) => { | 713 | }).then((result) => { |
714 | - if (result && result.code === 200) { | 714 | + if (result && result.code === 200 && result.data) { |
715 | if (result.data.banner) { | 715 | if (result.data.banner) { |
716 | return helpers.image(result.data.banner, 640, 150); | 716 | return helpers.image(result.data.banner, 640, 150); |
717 | } else { | 717 | } else { |
@@ -878,7 +878,7 @@ const shopCouponsList = (params) => { | @@ -878,7 +878,7 @@ const shopCouponsList = (params) => { | ||
878 | let shopCoupons = []; | 878 | let shopCoupons = []; |
879 | let couPonstatus; | 879 | let couPonstatus; |
880 | 880 | ||
881 | - if (result.data) { | 881 | + if (result && result.data) { |
882 | _.forEach(result.data, value => { | 882 | _.forEach(result.data, value => { |
883 | couPonstatus = parseInt(value.status, 10); | 883 | couPonstatus = parseInt(value.status, 10); |
884 | 884 | ||
@@ -919,7 +919,7 @@ const brandCouponsList = (params) => { | @@ -919,7 +919,7 @@ const brandCouponsList = (params) => { | ||
919 | let shopCoupons = []; | 919 | let shopCoupons = []; |
920 | let couPonstatus; | 920 | let couPonstatus; |
921 | 921 | ||
922 | - if (result.data && result.data.coupons) { | 922 | + if (result && result.data && result.data.coupons) { |
923 | _.forEach(result.data.coupons, value => { | 923 | _.forEach(result.data.coupons, value => { |
924 | couPonstatus = parseInt(value.status, 10); | 924 | couPonstatus = parseInt(value.status, 10); |
925 | 925 |
@@ -275,7 +275,7 @@ const newDetail = { | @@ -275,7 +275,7 @@ const newDetail = { | ||
275 | code: 200, | 275 | code: 200, |
276 | cache: true | 276 | cache: true |
277 | }).then(result => { | 277 | }).then(result => { |
278 | - if (result.code === 500 || !result.data) { | 278 | + if (!result || result.code === 500 || !result.data) { |
279 | return {}; | 279 | return {}; |
280 | } | 280 | } |
281 | 281 | ||
@@ -359,7 +359,7 @@ const newDetail = { | @@ -359,7 +359,7 @@ const newDetail = { | ||
359 | 359 | ||
360 | return api.get('', params, cacheConf) | 360 | return api.get('', params, cacheConf) |
361 | .then(result => { | 361 | .then(result => { |
362 | - if (result.code === 200) { | 362 | + if (result && result.code === 200) { |
363 | return tool.processShopsInfo(result.data); | 363 | return tool.processShopsInfo(result.data); |
364 | } | 364 | } |
365 | return []; | 365 | return []; |
@@ -3,7 +3,8 @@ const _ = require('lodash'); | @@ -3,7 +3,8 @@ const _ = require('lodash'); | ||
3 | // 黑名单参数 | 3 | // 黑名单参数 |
4 | const BLACK_LIST = [ | 4 | const BLACK_LIST = [ |
5 | 'client_secret', | 5 | 'client_secret', |
6 | - 'method' | 6 | + 'method', |
7 | + 'openby:yohobuy' | ||
7 | ]; | 8 | ]; |
8 | 9 | ||
9 | module.exports = () => { | 10 | module.exports = () => { |
@@ -8,8 +8,7 @@ var $ = require('yoho-jquery'), | @@ -8,8 +8,7 @@ var $ = require('yoho-jquery'), | ||
8 | security = require('../../plugin/security'), | 8 | security = require('../../plugin/security'), |
9 | tip = require('../../plugin/tip'), | 9 | tip = require('../../plugin/tip'), |
10 | Hammer = require('yoho-hammer'), | 10 | Hammer = require('yoho-hammer'), |
11 | - dialog = require('../../plugin/dialog'), | ||
12 | - Swiper = require('yoho-swiper'); | 11 | + dialog = require('../../plugin/dialog'); |
13 | 12 | ||
14 | var $input = $('#search-input input'); | 13 | var $input = $('#search-input input'); |
15 | 14 | ||
@@ -30,7 +29,7 @@ var writeSearch = require('./write-search'); | @@ -30,7 +29,7 @@ var writeSearch = require('./write-search'); | ||
30 | var ranToken = writeSearch.getRanToken(); | 29 | var ranToken = writeSearch.getRanToken(); |
31 | var historyval = writeSearch.getHistoryval(); | 30 | var historyval = writeSearch.getHistoryval(); |
32 | 31 | ||
33 | -var chHammer, cHammer, navSwiper; | 32 | +var chHammer, cHammer; |
34 | 33 | ||
35 | var C_ID, POS_ID, FLR_INDEX, prdLoad, querys, prdids = []; | 34 | var C_ID, POS_ID, FLR_INDEX, prdLoad, querys, prdids = []; |
36 | 35 | ||
@@ -212,8 +211,9 @@ $('.search-items .search-group').on('click', 'li', function(event) { | @@ -212,8 +211,9 @@ $('.search-items .search-group').on('click', 'li', function(event) { | ||
212 | 211 | ||
213 | $('.hot-term').on('click', function(event) { | 212 | $('.hot-term').on('click', function(event) { |
214 | var Hotquery = ''; | 213 | var Hotquery = ''; |
215 | - POS_ID = 2; | ||
216 | - FLR_INDEX = 2; | 214 | + |
215 | + POS_ID = 2; | ||
216 | + FLR_INDEX = 2; | ||
217 | 217 | ||
218 | if (event.target.nodeName === 'A') { | 218 | if (event.target.nodeName === 'A') { |
219 | Hotquery = $(event.target).html(); | 219 | Hotquery = $(event.target).html(); |
@@ -236,7 +236,7 @@ $('.hot-term').on('click', function(event) { | @@ -236,7 +236,7 @@ $('.hot-term').on('click', function(event) { | ||
236 | } | 236 | } |
237 | 237 | ||
238 | goSearch(Hotquery); | 238 | goSearch(Hotquery); |
239 | -}) | 239 | +}); |
240 | 240 | ||
241 | inputAction(); | 241 | inputAction(); |
242 | 242 |
-
Please register or login to post a comment