Authored by 毕凯

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

... ... @@ -9,6 +9,9 @@ exports.category = (req, res, next) => {
let uid = req.user.uid || req.query.uid;
let params = {
uid: uid,
port: 1,
channel: req.query.channel,
season: req.query.season,
isApp: req.yoho.isApp,
scene: req.query.scene || 1
};
... ... @@ -42,6 +45,9 @@ exports.shop = (req, res, next) => {
let uid = req.user.uid || req.query.uid;
let params = {
uid: uid,
port: 1,
channel: req.query.channel,
season: req.query.season,
isApp: req.yoho.isApp,
scene: req.query.scene || 1
};
... ...
'use strict';
const _ = require('lodash');
class shareModel extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -10,9 +11,19 @@ class shareModel extends global.yoho.BaseModel {
* @returns {*|Promise.<TResult>}
*/
getShareContent(params) {
let shareIdInt = _.parseInt(params.shareId);
if (shareIdInt) {
params.shareId = _.toString(shareIdInt);
} else {
return Promise.resolve({});
}
return this.get({
url: 'operations/api/v5/webshare/getShare',
data: {share_id: params.shareId},
data: {
share_id: params.shareId
},
api: global.yoho.ServiceAPI,
}).then(result => {
return result;
... ...
... ... @@ -78,7 +78,9 @@ class TideModel extends global.yoho.BaseModel {
crmRecommendShop(params) {
return this.get({
data: Object.assign({
method: 'app.product.crmRecommend.shop'
method: 'app.product.crmRecommend.shop',
imageType: 2,
imageSize: '314*352',
}, params)
});
}
... ... @@ -121,7 +123,7 @@ class TideModel extends global.yoho.BaseModel {
});
}
if (shopInfo.shopId || _.get(res[1], 'data.productList', []).length) {
if (shopInfo.imageUrl || _.get(res[1], 'data.productList', []).length) {
tide.shopInfo.push({
title: '# 为你精选 #',
shopInfo: shopInfo,
... ...
... ... @@ -72,7 +72,8 @@ class payModel extends global.yoho.BaseModel {
payment_amount: _.get(result, 'data.order_extInfo.payment_amount') ||
_.get(result, 'data.payment_amount'),
pay_expire: _.get(result, 'data.order_detail_info.ext.pay_expire') ||
_.get(result, 'data.pay_expire')
_.get(result, 'data.pay_expire'),
order_goods: _.get(result, 'data.order_goods')
}
};
}
... ... @@ -95,21 +96,14 @@ class payModel extends global.yoho.BaseModel {
// 购买此商品的用户也购买了,要先从订单详情获取商品skn
_getOthersBuy(param) {
return Promise.all([
this.getOtherDetail(param)
]).then((result) => {
this.getOtherDetail(param).then(result => {
let skn = _.get(result, 'data.order_goods.0.product_skn', '');
let goodSkn = '';
if (result && result[0] && result[0].data && result[0].data.order_goods) {
goodSkn = result[0].data.order_goods[0].product_skn;
if (skn) {
return this._getOthersBuy2(Object.assign(param, { skn: skn }));
} else {
return Promise.resolve([]);
}
return this._getOthersBuy2(Object.assign(param, { skn: goodSkn }));
}).then((result) => {
return result;
});
}
... ...
... ... @@ -59,11 +59,13 @@
</a>
{{/data}}
{{/banner}}
{{#if othersBuy}}
<div class="others-buy clearfix">
<p>购买此商品的用户也购买了</p>
{{# othersBuy}}
{{> common/goods}}
{{/ othersBuy}}
</div>
{{/if}}
{{> home/maybe-like}}
</div>
... ...
... ... @@ -185,13 +185,14 @@ module.exports = class extends global.yoho.BaseModel {
};
allList[key].forEach(row => {
obj.list.push({
name: row.brand_name,
isHot: row.is_hot === 'Y' ? true : false,
isNew: row.is_show_new === 'Y' ? true : false,
url: this._urlJump(parseInt(row.type, 10), row)
});
if (row) {
obj.list.push({
name: _.get(row, 'brand_name', ''),
isHot: _.get(row, 'is_hot') === 'Y' ? true : false,
isNew: _.get(row, 'is_show_new') === 'Y' ? true : false,
url: this._urlJump(parseInt(_.get(row, 'type'), 10), row)
});
}
});
resu.brandList.push(obj);
}
... ... @@ -207,9 +208,9 @@ module.exports = class extends global.yoho.BaseModel {
};
obj.list.push({
brandName: newList[key].brand_name,
url: this._urlJump(parseInt(newList[key].type, 10), newList[key]),
img: helpers.image(newList[key].brand_ico, 186, 115),
brandName: _.get(newList, `${key}.brand_name`, ''),
url: this._urlJump(parseInt(_.get(newList, `${key}.type`), 10), _.get(newList, `${key}`)),
img: helpers.image(_.get(newList, `${key}.brand_ico`), 186, 115),
});
resu.newBrandWall.push(obj);
}
... ...
... ... @@ -323,7 +323,6 @@ const local = {
domain: 'm.yohobuy.com'
});
// 弱密码返回数据
let passwordWeakReturn;
... ...
... ... @@ -10,6 +10,7 @@
'use strict';
const _ = require('lodash');
const config = global.yoho.config;
const utils = require(global.utils);
const ResetModel = require('../models/reset');
... ... @@ -48,7 +49,16 @@ const passwordResetPage = (req, res) => {
*/
const passwordReset = (req, res, next) => {
let passwordWeakObj = req.session.passwordWeak;
let uid = (req.user && req.user.uid) || (passwordWeakObj && passwordWeakObj.uid);
let uid = req.user && req.user.uid;
if (!uid && passwordWeakObj && passwordWeakObj.uid && passwordWeakObj.session_key) {
uid = {
toString: () => {
return _.parseInt(passwordWeakObj.uid);
},
sessionKey: passwordWeakObj.session_key
};
}
if (!uid || !passwordWeakObj || !passwordWeakObj.token) {
return res.json({
... ...
... ... @@ -300,6 +300,10 @@ module.exports = class extends global.yoho.BaseModel {
* 搜索店铺的商品
*/
getShopGoods(params) {
if (!/^[0-9]*$/.test(params.shop_id)) {
return Promise.resolve({});
}
let finalParams = {
method: 'app.search.shop',
};
... ...
... ... @@ -251,6 +251,14 @@ const getSearchParamsWithoutMethod = (params) => {
finalParams.brand = params.brand_id || params.brand;
}
if (params.shop_id && params.shop_id !== '0') { // 店铺ID
let shopIdInt = _.parseInt(params.shop_id);
if (shopIdInt) {
params.shop_id = _.toString(shopIdInt);
} else {
params.shop_id = '';
}
finalParams.shop_id = params.shop_id;
}
if (params.type) { // 排序类型
... ...