Authored by htoooth

Merge branch 'hotfix/fix-reqid' of http://git.yoho.cn/fe/yohobuy-node into release/6.3

... ... @@ -61,6 +61,11 @@ app.enable('trust proxy');
app.set('subdomain offset', 2);
app.use((req, res, next) => {
req.isApmReport = _.get(req.app.locals, 'pc.open.bughd', false);
next();
});
// 添加请求上下文
app.use(global.yoho.httpCtx());
... ... @@ -86,7 +91,6 @@ require('./doraemon/middleware/yoho-session')(app);
app.use((req, res, next) => {
req.user = {}; // 全局的用户数据
req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
req.isApmReport = _.get(req.app.locals, 'pc.open.bughd', false);
if (!req.session) {
req.session = {};
... ...
... ... @@ -241,7 +241,9 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys
* 购物车统计
*/
const formatShoppingCartData = (sc) => {
if (!sc) {
return {};
}
return {
discountAmount: sc.discount_amount, // 活动价
fastShoppingCost: sc.fast_shopping_cost,
... ...
... ... @@ -33,7 +33,7 @@ module.exports = class extends global.yoho.BaseModel {
if (info) {
Object.assign(resData, {
yoho_coin: info.yoho_coin.toFixed(2),
yoho_coin: info.yoho_coin ? info.yoho_coin.toFixed(2) : 0,
use_yoho_coin: info.use_yoho_coin,
total_yoho_coin_num: info.total_yoho_coin_num,
yoho_coin_pay_rule: info.yoho_coin_pay_rule,
... ...
... ... @@ -190,7 +190,7 @@ module.exports = class favorite extends global.yoho.BaseModel {
page = page > pageTotal ? pageTotal : page;
result.goods = that.getGoodsInfo(productList, page, limit);
result.pager = pager(total, Object.assign(query, {hasCheckAll: true}));
result.pager = pager(total, Object.assign({}, query, {hasCheckAll: true}));
return result;
})();
... ...
... ... @@ -311,7 +311,7 @@ module.exports = class extends global.yoho.BaseModel {
],
certifiedName: +isStudent ? '学生身份已验证' : '身份验证',
certifiedUrl: helpers.urlFormat('/product/students/'),
latestOrders: Object.assign(indexData.recentOrder, {cancelReason: indexData.reason})
latestOrders: Object.assign({}, indexData.recentOrder, {cancelReason: indexData.reason})
},
banner: indexData.footerBanner
}
... ...
... ... @@ -822,7 +822,7 @@ module.exports = class extends global.yoho.BaseModel {
detail.orderInfo = {
receiver: orderDetail.user_name,
address: orderDetail.area + orderDetail.address,
phone: _.fill(orderDetail.mobile.split(''), '*', 3, 4).join('') +
phone: _.fill((orderDetail.mobile ? orderDetail.mobile.split('') : ''), '*', 3, 4).join('') +
(orderDetail.phone ? ',' + _.fill(orderDetail.phone.split(''), '*', 3, 5).join('') : '')
};
... ...
... ... @@ -1007,7 +1007,7 @@ function _getCoupon(coupons) {
let pickProp = Fn.pick(['couponName', 'amount', 'couponId', 'acquireStatus', 'rule4ShortName']);
let encodeId = Fn.update('couponId', (cid) => crypto.encryption(null, cid + ''));
let replace = Fn.update('rule4ShortName', (r) => r.replace(/¥/g, '));
let replace = Fn.update('rule4ShortName', (r) => (r ? r.replace(/¥/g, '¥') : ''));
return Fn.map(Fn.pipe(pickProp, encodeId, replace))(couponList);
}
... ...
... ... @@ -212,7 +212,7 @@ class FilterTools {
const condition = {};
if (k === 'price') {
if (filter.priceRange[params.price]) {
if (filter.priceRange && filter.priceRange[params.price]) {
condition.name = filter.priceRange[params.price].replace('¥', '¥');
} else {
const prices = _.split(params.price, ',');
... ...
... ... @@ -57,7 +57,7 @@
"urlencode": "^1.1.0",
"uuid": "^2.0.2",
"yoho-express-session": "^2.0.0",
"yoho-node-lib": "=0.5.29",
"yoho-node-lib": "=0.5.30",
"yoho-zookeeper": "^1.0.8"
},
"devDependencies": {
... ...