Showing
4 changed files
with
10 additions
and
13 deletions
@@ -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 | } |
@@ -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 []; |
-
Please register or login to post a comment