Authored by 毕凯

Merge branch '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,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',
};
... ...
... ... @@ -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": {
... ... @@ -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);
... ...
... ... @@ -8,7 +8,6 @@ require('layout/_modal.css');
require('home/order-list.page.css');
let $ = require('yoho-jquery'),
Hammer = require('yoho-hammer'),
lazyLoad = require('yoho-jquery-lazyload'),
tip = require('plugin/tip'),
Swiper = require('yoho-swiper');
... ... @@ -33,8 +32,7 @@ let loading = require('plugin/loading');
let dialog = require('plugin/dialog');
let orderHammer,
$reaMask = $('.reason-mask'),
let $reaMask = $('.reason-mask'),
$refundReaMask = $('.refund-reason-mask'),
reasonSwiper,
refundReasonSwiper;
... ... @@ -222,8 +220,7 @@ function sureOrder(orderId) {
}
// 点击订单区域跳转订单详情页
orderHammer = new Hammer(document.getElementById('order-container'));
orderHammer.on('tap', function(e) {
$('#order-container').on('click', function(e) {
let $cur = $(e.target),
$order,
id,
... ...
... ... @@ -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) { // 排序类型
... ...