Authored by 郭成尧

Merge branch 'master' into feature/buynow

... ... @@ -17,8 +17,8 @@ exports.submit = (req, res) => {
remoteIp = arr[0];
}
let key = `h5:limiter:${remoteIp}`;
let key10m = `h5:limiter:10m:${remoteIp}`;
let key = `pc:limiter:${remoteIp}`;
let key10m = `pc:limiter:10m:${remoteIp}`;
Promise.all([
cache.delAsync(key),
... ...
... ... @@ -40,7 +40,7 @@ const itemXmlData = () => {// eslint-disable-line
return api.get('', {method: 'web.product.bdPromotion'}, {cache: 86400}).then(res => {
_.forEach(_.get(res, 'data', ''), val => {
urls.push({
url: 'https:' + helpers.urlFormat(`/product/${val.id}.html`, '', null),
url: 'https:' + helpers.urlFormat(`/product/${val.erpProductId}.html`, '', null),
changefreq: 'daily',
priority: 0.3
});
... ...
... ... @@ -140,20 +140,25 @@ const newDetail = {
},
indexData(req, res, next) {
if (!req.xhr) {
return next();
}
if (!req.body.id) {
// for guang
let allowOrigin = _.get(req, 'headers.origin', null) ?
req.headers.origin : req.protocol + '://guang.' + req.headers.host;
res.setHeader('Access-Control-Allow-Origin', allowOrigin);
res.setHeader('Access-Control-Allow-Credentials', 'true');
if (!req.query.id && !req.query.productSkn) {
return next();
}
let uid = req.user.uid || 0;
let shoppingKey = req.cookies._SPK || '';
detailModel.getNewProductAsyncData(Object.assign({
id: req.body.id,
goodsId: req.body.goodsId,
productSkn: req.body.productSkn,
bundleType: req.body.bundleType,
id: req.query.id,
goodsId: req.query.goodsId,
productSkn: req.query.productSkn,
bundleType: req.query.bundleType,
uid: uid,
shoppingKey: shoppingKey,
ua: req.get('user-agent') || ''
... ...
... ... @@ -77,8 +77,7 @@ router.get('/detail/preference', detail.preference); // 为你优选
router.get('/detail/consults', detail.consults); // 商品咨询页
router.get('/detail/consultform', auth, detail.consultform); // 商品咨询表单页
router.get('/detail/comments', detail.comments); // 商品评价
router.post('/detail/info', detail.getUser, detail.indexData); // 商品详情页-异步数据
router.post('/detail/newinfo', detail.getUser, newDetail.indexData); // 商品详情页-异步数据 (优化)
router.get('/detail/newinfo', detail.getUser, newDetail.indexData); // 商品详情页-异步数据 (优化)
router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口
... ...
... ... @@ -29,8 +29,8 @@ module.exports = (limiter, policy) => {
const req = limiter.req,
res = limiter.res;
const key = `h5:limiter:${limiter.remoteIp}`;
const key10m = `h5:limiter:10m:${limiter.remoteIp}`;
const key = `pc:limiter:${limiter.remoteIp}`;
const key10m = `pc:limiter:10m:${limiter.remoteIp}`;
res.on('render', function() {
let route = req.route ? req.route.path : '';
... ...
{
"name": "m-yohobuy-node",
"version": "5.8.1",
"version": "5.8.2",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -19,10 +19,6 @@ let shareData = {
require('common');
require('common/share')(shareData);
if ($('.share-buy-page').height() < $(window).height()) {
$('.share-buy-page').height($(window).height());
}
if (yoho.isApp) {
if (window.queryString.act_id) {
shareData.link = 'http://m.yohobuy.com/activity/share-buy?act_id=' + window.queryString.act_id;
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-05-08 09:43:20
* @Last Modified by: Targaryen
* @Last Modified time: 2017-05-09 11:31:56
* @Last Modified time: 2017-06-20 09:40:29
*/
const $ = require('yoho-jquery');
... ... @@ -15,7 +15,7 @@ $addToCart.on('click', function(e) {
let $this = $(e.currentTarget);
let productSkn = $this.data('skn');
$.post(location.protocol + '//m.yohobuy.com/product/detail/info', {
$.get(location.protocol + '//m.yohobuy.com/product/detail/newinfo', {
productSkn: productSkn
}, function(data) {
chosePanel.show({data}).then(result => {
... ...
... ... @@ -45,7 +45,7 @@ $(function() {
$selectBtn.on('touchend', function() {
let self = $(this);
$.post('/product/detail/info', {
$.get('/product/detail/newinfo', {
id: self.data('id'),
productSkn: self.data('skn')
}, function(data) {
... ...
... ... @@ -11,8 +11,8 @@ module.exports = function(callback) {
if (productId && (goodsId || productSkn)) {
$.ajax({
type: 'POST',
url: '/product/detail/info',
type: 'GET',
url: '/product/detail/newinfo',
data: {
id: productId,
goodsId: goodsId,
... ...
... ... @@ -98,7 +98,7 @@ setTimeout(() => {
if (productId && (goodsId || productSkn)) {
setTimeout(() => {
$.ajax({
type: 'POST',
type: 'GET',
url: '/product/detail/newinfo',
data: {
id: productId,
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-03-24 13:43:55
* @Last Modified by: Targaryen
* @Last Modified time: 2017-03-31 14:46:52
* @Last Modified time: 2017-06-20 09:50:01
*/
/** *****************************
... ... @@ -192,7 +192,7 @@ $listNav.bind('contextmenu', function() {
});
$listNav.on('touchend touchcancel', function(e) {
page = 0;
page = 1;
beforeScroll = $(window).scrollTop();
isScrollLoad = false;
... ...
.share-buy-page {
width: 100%;
body {
height: 100%;
}
.main-wrap {
height: 100%;
background-image: resolve("activity/share-buy/back.jpg");
background-size: 100%;
}
.share-buy-page {
width: 100%;
height: 100%;
padding-bottom: 145px;
.share-title {
... ...