Authored by 王水玲

Merge branch 'master' into feature/page-penetration

... ... @@ -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
};
... ...
... ... @@ -67,7 +67,7 @@ function droitHtml(contents) {
intros: [
{ title: '特权介绍', data: ['会员在有货平台上购买符合活动规则的商品后,可获得商品实付金额一定比例的有货币。'] },
{ title: '领取说明', data: [
'在线支付订单订单完成后可获得该等级对应的有货币奖励,货到付款发货15天后发放有货币,有货币按照该等级对应的比例发放。',
'在线支付订单订单完成后可获得该等级对应的有货币奖励货到付款发货15天后发放有货币,有货币按照该等级对应的比例发放。',
'有货币可抵现,抵现比例100:1。',
'退货后会扣除返还的有货币,若有货币不足,将会从原订单退款金额中扣除相应的退款。'
]
... ... @@ -117,7 +117,7 @@ function droitHtml(contents) {
'升级礼包可在会员中心-我的礼包页面领取。',
'每个等级的礼包365天仅发放一次。',
'若在上述时间段内未领取,将无法补发升级礼包。',
'老版本用户需更新至新版本app才可领取生日礼包。'
'老版本用户需更新至新版本app才可领取升级礼包。'
]
}
]
... ...
'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,9 @@ 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'),
package_info: _.get(result, 'data.package_info', [])
}
};
}
... ... @@ -83,6 +85,8 @@ class payModel extends global.yoho.BaseModel {
return Promise.resolve({});
}
param.uid.appVersion = _.get(global, 'yoho.config.appVersion');
return this.get({data: {
method: 'app.SpaceOrders.detail',
uid: param.uid,
... ... @@ -95,21 +99,14 @@ class payModel extends global.yoho.BaseModel {
// 购买此商品的用户也购买了,要先从订单详情获取商品skn
_getOthersBuy(param) {
return Promise.all([
this.getOtherDetail(param)
]).then((result) => {
let goodSkn = '';
this.getOtherDetail(param).then(result => {
let skn = _.get(result, 'data.order_goods.0.product_skn', '');
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);
}
... ...
... ... @@ -172,6 +172,8 @@ module.exports = class extends global.yoho.BaseModel {
return Promise.resolve({});
}
uid.appVersion = _.get(global, 'yoho.config.appVersion');
return this.get({
data: {
method: 'app.SpaceOrders.detail',
... ...
... ... @@ -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',
};
... ...
... ... @@ -155,6 +155,9 @@ router.get('/search/shop/goods', search.searchShopGoods); // 搜索店铺下的
router.get('/list/global(/:pathParams)?', rewrite.resolvePathParams, globalPro.list); // 全球购路由重写 全球购列表页
router.get('/index/index', rewrite.resolvePathParams, list.listNew); // 列表新的 URL
router.get('/list/index', rewrite.resolvePathParams, list.listNew); // 旧 兼容 PC 的链接
router.get('/list(/:pathParams)?', rewrite.resolvePathParams, list.listNew); // 列表新的 URL
router.get('/search/category',
cors,
... ...
... ... @@ -42,7 +42,7 @@ const domains = {
module.exports = {
app: 'h5',
appVersion: '6.5.3', // 调用api的版本
appVersion: '6.6.0', // 调用api的版本
appName: 'yohobuywap-node',
port: 6001,
siteUrl: '//m.yohobuy.com',
... ...
{
"name": "yohobuywap-node",
"version": "6.6.2",
"version": "6.6.3",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -15,7 +15,7 @@
"build:dll": "webpack --config ./public/build/webpack.dll.indexcss.config.js",
"build": "webpack --config ./public/build/webpack.dll.indexcss.config.js && webpack --config ./public/build/webpack.prod.config.js",
"debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js",
"lint:css": "stylelint -s scss --cache --custom-formatter ./node_modules/stylelint-formatter-table",
"lint:css": "stylelint -s scss --config .stylelintrc.js --cache --custom-formatter ./node_modules/stylelint-formatter-table",
"lint:js": "eslint --ext .js,.vue --cache --format table",
"lint-css": "npm run -s lint:css -- ./**/*.{scss,css,vue}",
"lint-js": "npm run -s lint:js -- .",
... ... @@ -101,7 +101,7 @@
"css-loader": "^0.28.11",
"echarts": "^4.0.4",
"eslint": "^4.19.1",
"eslint-config-yoho": "^1.0.9",
"eslint-config-yoho": "~1.0.9",
"eslint-plugin-html": "^4.0.3",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"friendly-errors-webpack-plugin": "^1.7.0",
... ... @@ -131,7 +131,7 @@
"store": "^2.0.12",
"style-loader": "^0.21.0",
"stylelint": "^9.2.0",
"stylelint-config-yoho": "^1.3.0",
"stylelint-config-yoho": "~1.3.0",
"stylelint-formatter-table": "^1.0.2",
"vue": "^2.5.16",
"vue-infinite-scroll": "^2.0.1",
... ...
... ... @@ -6,7 +6,7 @@ const cookie = require('yoho-cookie');
const u = navigator.userAgent;
const isFromYOHO = /m\.yohobuy\.com/i.test(document.referrer);
const isApp = /yohobuy/i.test(u) ||
const isApp = /yoho/i.test(u) ||
!!window.yohoInterface ||
/app_version=/i.test(location.search) ||
/openrefer=/i.test(location.search);
... ...
... ... @@ -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) { // 排序类型
... ...