Authored by 郭成尧

Merge branch 'hotfix/smslogin' of git.yoho.cn:fe/yohobuywap-node into hotfix/smslogin

... ... @@ -172,8 +172,12 @@ class BuyNowController {
use_yoho_coin: req.body.use_yoho_coin
});
result.data.use_yoho_coin = paymentProcess.transPrice(_.get(result, 'data.use_yoho_coin'));
result.data.yohoCoinCompute = paymentProcess.yohoCoinCompute(result.data);
let finalResult = _.get(result, 'data', {});
if (finalResult) {
_.set(finalResult, 'use_yoho_coin', paymentProcess.transPrice(_.get(result, 'data.use_yoho_coin')));
_.set(finalResult, 'yohoCoinCompute', paymentProcess.yohoCoinCompute(result.data));
}
return res.json(result.data);
})().catch(next);
}
... ...
... ... @@ -6,6 +6,7 @@
'use strict';
const _ = require('lodash');
const helpers = global.yoho.helpers;
// const utils = '../../../utils';
... ... @@ -122,7 +123,7 @@ module.exports = class extends global.yoho.BaseModel {
let adList = result.data[0].data;
let build = [];
adList.forEach(ad => {
_.forEach(adList, ad => {
build.push({
img: helpers.image(ad.src, 640, 240),
url: ad.url
... ...
... ... @@ -285,7 +285,7 @@ class DetailModel extends global.yoho.BaseModel {
if (getArticleContent[i].text && textPosition === 1) {
descriptionText = _.get(getArticleContent[i], 'text.data.text');
_.set(result, 'getArticle.descriptionText', descriptionText.replace(/<\/?[^>]*>/g, ''));
_.set(result, 'getArticle.descriptionText', _.replace(descriptionText, /<\/?[^>]*>/g, ''));
textPosition++;
}
}
... ...
... ... @@ -139,10 +139,10 @@ exports.recordContent = (req, res, next) => {
req.ctx(indexModel).recordContent(uid, udid, page, limit).then((result) => {
if (result.browseRecord && result.browseRecord.length === 0) {
if (result && result.browseRecord && result.browseRecord.length === 0) {
res.json(false);
} else {
res.render('browse-record-content', Object.assign({
res.render('browse-record-content', _.assign({
layout: false
}, result));
}
... ...
... ... @@ -274,7 +274,7 @@ const local = {
passport.authenticate('local', (err, user) => {
if (err || !user) {
if (err.code === 4189) {
if (_.get(err, 'code') === 4189) {
let obj = {
code: 4189,
message: err || '登录出错请重试',
... ...
... ... @@ -416,9 +416,10 @@ const getCategoryGoods = (req, res, next) => {
params.limit = 24;
req.ctx(searchModel).getCategoryGoods(params).then((result) => {
if (result.data.product_list && result.data.product_list.length > 0) {
let productList = _.get(result, 'data.product_list', []);
let product_list = productProcess.processProductList(result.data.product_list || [], {
if (productList.length > 0) {
let product_list = productProcess.processProductList(productList, {
isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'),
gender: _coverChannel[params.coverChannel],
showSimilar: params.shop_id || params.material === 'true' ? false : true
... ... @@ -427,7 +428,7 @@ const getCategoryGoods = (req, res, next) => {
res.render('search/page', {
layout: false,
new: product_list,
total: result.data.total,
total: _.get(result, 'data.total', 0)
});
} else {
res.json({});
... ...
... ... @@ -525,7 +525,9 @@ const pushGoodsInfo = (finalDetail, goodsList, isApp) => {
if (value.collocation) {
_.forEach(value.collocation, (item, subKey) => {
_.forEach(item.goods, (thItem, thKey) => {
finalDetail[key].collocation[subKey].goods[thKey] = goodsObj[thItem.id];
if (thItem) {
finalDetail[key].collocation[subKey].goods[thKey] = goodsObj[thItem.id];
}
});
});
}
... ...