Merge branch 'master' into release/5.6
Showing
8 changed files
with
47 additions
and
29 deletions
@@ -148,6 +148,17 @@ app.use((req, res, next) => { | @@ -148,6 +148,17 @@ app.use((req, res, next) => { | ||
148 | req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等 | 148 | req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等 |
149 | req.app.locals.wap = app.locals.wap; // zookeper对象赋值 | 149 | req.app.locals.wap = app.locals.wap; // zookeper对象赋值 |
150 | 150 | ||
151 | + // 临时增加错误日志记录 | ||
152 | + let sendJson = res.json; | ||
153 | + | ||
154 | + res.json = function(...args) { | ||
155 | + try { | ||
156 | + sendJson(...args); | ||
157 | + } catch (e) { | ||
158 | + logger.error(`res.json error data: ${JSON.stringify(args)}`); | ||
159 | + } | ||
160 | + }; | ||
161 | + | ||
151 | next(); | 162 | next(); |
152 | }); | 163 | }); |
153 | 164 |
@@ -373,7 +373,7 @@ const order = (params) => { | @@ -373,7 +373,7 @@ const order = (params) => { | ||
373 | code: 200 | 373 | code: 200 |
374 | }).then((result) => { | 374 | }).then((result) => { |
375 | 375 | ||
376 | - if (result.data) { | 376 | + if (result && result.data) { |
377 | Object.assign(finalResult, {cancelReason: result.data}); | 377 | Object.assign(finalResult, {cancelReason: result.data}); |
378 | } | 378 | } |
379 | return finalResult; | 379 | return finalResult; |
@@ -385,7 +385,7 @@ const order = (params) => { | @@ -385,7 +385,7 @@ const order = (params) => { | ||
385 | * @param params | 385 | * @param params |
386 | */ | 386 | */ |
387 | const getOrders = (params) => { | 387 | const getOrders = (params) => { |
388 | - let finalResult = Promise.resolve([]); | 388 | + let finalResult = []; |
389 | 389 | ||
390 | if (!params.uid) { | 390 | if (!params.uid) { |
391 | return Promise.resolve([]); | 391 | return Promise.resolve([]); |
@@ -182,7 +182,6 @@ exports.orderSub = (req, res, next) => { | @@ -182,7 +182,6 @@ exports.orderSub = (req, res, next) => { | ||
182 | let yohoCoin = req.body.yohoCoin || 0; | 182 | let yohoCoin = req.body.yohoCoin || 0; |
183 | let skuList = req.body.skuList || ''; | 183 | let skuList = req.body.skuList || ''; |
184 | let orderInfo; | 184 | let orderInfo; |
185 | - let isWechat = req.yoho.isWechat; | ||
186 | 185 | ||
187 | try { | 186 | try { |
188 | orderInfo = JSON.parse(req.cookies['order-info']); | 187 | orderInfo = JSON.parse(req.cookies['order-info']); |
@@ -254,7 +253,15 @@ exports.orderSub = (req, res, next) => { | @@ -254,7 +253,15 @@ exports.orderSub = (req, res, next) => { | ||
254 | 253 | ||
255 | return co(function* () { | 254 | return co(function* () { |
256 | let result; | 255 | let result; |
257 | - let ip = req.ip || ''; | 256 | + |
257 | + // 接口需要的其他参数 | ||
258 | + let otherParams = { | ||
259 | + unionKey: unionKey, // 友盟数据 | ||
260 | + userAgent: userAgent, | ||
261 | + isWechat: req.yoho.isWechat, | ||
262 | + ip: req.ip || '', | ||
263 | + udid: req.cookies._yasvd || 'yoho' | ||
264 | + }; | ||
258 | 265 | ||
259 | /* tar modified 161206 套餐 */ | 266 | /* tar modified 161206 套餐 */ |
260 | if (req.body.cartType === 'bundle') { | 267 | if (req.body.cartType === 'bundle') { |
@@ -262,11 +269,11 @@ exports.orderSub = (req, res, next) => { | @@ -262,11 +269,11 @@ exports.orderSub = (req, res, next) => { | ||
262 | 269 | ||
263 | result = yield cartModel.orderSub(uid, addressId, 'bundle', deliveryTimeId, | 270 | result = yield cartModel.orderSub(uid, addressId, 'bundle', deliveryTimeId, |
264 | deliveryId, invoices, paymentTypeId, paymentType, msg, couponCode, | 271 | deliveryId, invoices, paymentTypeId, paymentType, msg, couponCode, |
265 | - yohoCoin, null, unionKey, userAgent, times, activityInfo, ip, isWechat); | 272 | + yohoCoin, null, times, activityInfo, otherParams); |
266 | } else { | 273 | } else { |
267 | result = yield cartModel.orderSub(uid, addressId, cartType, deliveryTimeId, | 274 | result = yield cartModel.orderSub(uid, addressId, cartType, deliveryTimeId, |
268 | deliveryId, invoices, paymentTypeId, paymentType, msg, couponCode, | 275 | deliveryId, invoices, paymentTypeId, paymentType, msg, couponCode, |
269 | - yohoCoin, skuList, unionKey, userAgent, null, null, ip, isWechat); | 276 | + yohoCoin, skuList, null, null, otherParams); |
270 | } | 277 | } |
271 | 278 | ||
272 | // 提交成功清除Cookie | 279 | // 提交成功清除Cookie |
@@ -180,23 +180,21 @@ exports.ticketsOrderCompute = (uid, productSku, buyNumber, yohoCoin) => { | @@ -180,23 +180,21 @@ exports.ticketsOrderCompute = (uid, productSku, buyNumber, yohoCoin) => { | ||
180 | * @param string $couponCode 优惠券码 | 180 | * @param string $couponCode 优惠券码 |
181 | * @param mixed $yohoCoin 使用的有货币数量或为空 | 181 | * @param mixed $yohoCoin 使用的有货币数量或为空 |
182 | * @param string $skuList 购买限购商品时需要传递的参数 | 182 | * @param string $skuList 购买限购商品时需要传递的参数 |
183 | - * @param string $qhyUnio 友盟有关信息 | ||
184 | * @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息 | 183 | * @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息 |
185 | * @param int $times | 184 | * @param int $times |
186 | * @param null $activityInfo 套餐数据 | 185 | * @param null $activityInfo 套餐数据 |
187 | - * @param isWechat 是否是微信商城 | 186 | + * @param otherParams 其他参数 |
188 | * @return array 接口返回的数据 | 187 | * @return array 接口返回的数据 |
189 | */ | 188 | */ |
190 | exports.orderSub = (uid, addressId, cartType, deliveryTime, | 189 | exports.orderSub = (uid, addressId, cartType, deliveryTime, |
191 | deliveryWay, invoices, paymentId, paymentType, remark, | 190 | deliveryWay, invoices, paymentId, paymentType, remark, |
192 | - couponCode, yohoCoin, skuList, qhyUnio, | ||
193 | - userAgent, times, activityInfo, ip, isWechat) => { | ||
194 | - if (!qhyUnio) { | ||
195 | - qhyUnio = ''; | 191 | + couponCode, yohoCoin, skuList, times, activityInfo, otherParams) => { |
192 | + if (!otherParams.unionKey) { | ||
193 | + otherParams.unionKey = ''; | ||
196 | } | 194 | } |
197 | 195 | ||
198 | - if (!userAgent) { | ||
199 | - userAgent = null; | 196 | + if (!otherParams.userAgent) { |
197 | + otherParams.userAgent = null; | ||
200 | } | 198 | } |
201 | 199 | ||
202 | if (!times) { | 200 | if (!times) { |
@@ -221,8 +219,7 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime, | @@ -221,8 +219,7 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime, | ||
221 | 219 | ||
222 | return shoppingAPI.orderSub(uid, addressId, cartType, deliveryTime, | 220 | return shoppingAPI.orderSub(uid, addressId, cartType, deliveryTime, |
223 | deliveryWay, invoices, paymentId, paymentType, | 221 | deliveryWay, invoices, paymentId, paymentType, |
224 | - remark, couponCode, yohoCoin, skuList, qhyUnio, | ||
225 | - userAgent, times, activityInfo, ip, isWechat).then(orderSubRes => { | 222 | + remark, couponCode, yohoCoin, skuList, times, activityInfo, otherParams).then(orderSubRes => { |
226 | let finalResult = {}; | 223 | let finalResult = {}; |
227 | 224 | ||
228 | if (orderSubRes && orderSubRes.data && orderSubRes.data.is_hint === 'Y') { | 225 | if (orderSubRes && orderSubRes.data && orderSubRes.data.is_hint === 'Y') { |
@@ -149,16 +149,15 @@ exports.checkTickets = (uid, productSku, buyNumber, useYohoCoin, yohoCoinMode) = | @@ -149,16 +149,15 @@ exports.checkTickets = (uid, productSku, buyNumber, useYohoCoin, yohoCoinMode) = | ||
149 | * @param string $couponCode 优惠券码 | 149 | * @param string $couponCode 优惠券码 |
150 | * @param mixed $yohoCoin 使用的有货币数量或为空 | 150 | * @param mixed $yohoCoin 使用的有货币数量或为空 |
151 | * @param string $skuList 购买限购商品时需要传递的参数 | 151 | * @param string $skuList 购买限购商品时需要传递的参数 |
152 | - * @param string $qhyUnion 友盟有关信息 | ||
153 | * @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息 | 152 | * @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息 |
154 | * @param $times | 153 | * @param $times |
155 | * @param null $activityInfo 套餐信息 | 154 | * @param null $activityInfo 套餐信息 |
156 | - * @param isWechat 是否是微信商城 | 155 | + * @param @param otherParams 其他参数 |
157 | * @return array 接口返回的数据 | 156 | * @return array 接口返回的数据 |
158 | */ | 157 | */ |
159 | exports.orderSub = (uid, addressId, cartType, deliveryTime, | 158 | exports.orderSub = (uid, addressId, cartType, deliveryTime, |
160 | deliveryWay, invoices, paymentId, paymentType, remark, couponCode, | 159 | deliveryWay, invoices, paymentId, paymentType, remark, couponCode, |
161 | - yohoCoin, skuList, qhyUnion, userAgent, times, activityInfo, ip, isWechat) => { | 160 | + yohoCoin, skuList, times, activityInfo, otherParams) => { |
162 | if (!activityInfo) { | 161 | if (!activityInfo) { |
163 | activityInfo = null; | 162 | activityInfo = null; |
164 | } | 163 | } |
@@ -173,7 +172,8 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime, | @@ -173,7 +172,8 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime, | ||
173 | payment_id: paymentId, | 172 | payment_id: paymentId, |
174 | payment_type: paymentType, | 173 | payment_type: paymentType, |
175 | remark: remark, | 174 | remark: remark, |
176 | - uid: uid | 175 | + uid: uid, |
176 | + udid: otherParams.udid | ||
177 | }; | 177 | }; |
178 | 178 | ||
179 | /* tar add 161130 结算优化 */ | 179 | /* tar add 161130 结算优化 */ |
@@ -223,19 +223,19 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime, | @@ -223,19 +223,19 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime, | ||
223 | } | 223 | } |
224 | 224 | ||
225 | // 友盟有关信息的传递 | 225 | // 友盟有关信息的传递 |
226 | - if (qhyUnion) { | ||
227 | - params.qhy_union = qhyUnion; | 226 | + if (otherParams.unionKey) { |
227 | + params.qhy_union = otherParams.unionKey; | ||
228 | } | 228 | } |
229 | 229 | ||
230 | // 是否是微信商城 | 230 | // 是否是微信商城 |
231 | - if (isWechat) { | 231 | + if (otherParams.isWechat) { |
232 | params.client_type = 'wechat'; | 232 | params.client_type = 'wechat'; |
233 | } | 233 | } |
234 | 234 | ||
235 | return api.post('', params, { | 235 | return api.post('', params, { |
236 | headers: { | 236 | headers: { |
237 | - 'X-Forwarded-For': ip || '', | ||
238 | - 'User-Agent': userAgent | 237 | + 'X-Forwarded-For': otherParams.ip || '', |
238 | + 'User-Agent': otherParams.userAgent | ||
239 | } | 239 | } |
240 | }); | 240 | }); |
241 | }; | 241 | }; |
@@ -188,6 +188,7 @@ const addressModify = (req, res, next) => { | @@ -188,6 +188,7 @@ const addressModify = (req, res, next) => { | ||
188 | */ | 188 | */ |
189 | const changeAddress = (req, res, next) => { | 189 | const changeAddress = (req, res, next) => { |
190 | let uid = req.user.uid; | 190 | let uid = req.user.uid; |
191 | + let udid = req.cookies._yasvd || 'yoho'; | ||
191 | 192 | ||
192 | if (!uid) { | 193 | if (!uid) { |
193 | return res.json({ | 194 | return res.json({ |
@@ -202,7 +203,8 @@ const changeAddress = (req, res, next) => { | @@ -202,7 +203,8 @@ const changeAddress = (req, res, next) => { | ||
202 | username: req.body.username, | 203 | username: req.body.username, |
203 | areaCode: req.body.area_code, | 204 | areaCode: req.body.area_code, |
204 | address: req.body.address, | 205 | address: req.body.address, |
205 | - mobile: req.body.mobile | 206 | + mobile: req.body.mobile, |
207 | + udid: udid | ||
206 | }).then(result => { | 208 | }).then(result => { |
207 | res.json(result); | 209 | res.json(result); |
208 | }).catch(next); | 210 | }).catch(next); |
@@ -395,7 +395,8 @@ const changeAddress = (params) => { | @@ -395,7 +395,8 @@ const changeAddress = (params) => { | ||
395 | user_name: params.username, | 395 | user_name: params.username, |
396 | area_code: params.areaCode, | 396 | area_code: params.areaCode, |
397 | address: params.address, | 397 | address: params.address, |
398 | - mobile: params.mobile | 398 | + mobile: params.mobile, |
399 | + udid: params.udid | ||
399 | }; | 400 | }; |
400 | 401 | ||
401 | if (params.addressId) { | 402 | if (params.addressId) { |
@@ -90,8 +90,8 @@ router.get('/helpDetail', help.helpDetail); | @@ -90,8 +90,8 @@ router.get('/helpDetail', help.helpDetail); | ||
90 | // 意见反馈 | 90 | // 意见反馈 |
91 | router.get('/suggest', suggest.suggestData); | 91 | router.get('/suggest', suggest.suggestData); |
92 | router.post('/upAndDown', suggest.upAndDown); | 92 | router.post('/upAndDown', suggest.upAndDown); |
93 | -router.get('/suggestSub', suggest.suggestSub); | ||
94 | -router.post('/savesuggest', suggest.saveSuggest); | 93 | +router.get('/suggestSub', auth, suggest.suggestSub); |
94 | +router.post('/savesuggest', auth, suggest.saveSuggest); | ||
95 | 95 | ||
96 | // 消息 | 96 | // 消息 |
97 | router.use('/message', auth, disableBFCache, message.index); | 97 | router.use('/message', auth, disableBFCache, message.index); |
-
Please register or login to post a comment