Authored by 陈峰

降级字段判断用lodash

'use strict';
const mRoot = '../models';
const _ = require('lodash');
const recommendForYouModel = require(`${mRoot}/recommend-for-you`); // 领取优惠券 model
exports.userCenter = (req, res, next) => {
... ... @@ -33,7 +34,7 @@ exports.cart = (req, res, next) => {
uid = req.user.uid || 0,
yhChannel = req.query.yh_channel || '1',
limit = 30;
if (req.app.locals.wap.cart.removePrefer) {
if (_.get(req, 'app.locals.wap.cart.removePrefer', false)) {
return res.send('');
}
recommendForYouModel.getPreference({
... ...
... ... @@ -133,7 +133,7 @@ const list = (req, res, next) => {
const index = (req, res, next) => {
let title = '搜索';
((render) => {
if (req.app.locals.wap.search.removeHotSearch) {
if (_.get(req, 'app.locals.wap.search.removeHotSearch', false)) {
render([]);
} else {
searchModel.getSearchIndex().then((result) => {
... ...