Authored by 郭成尧

Merge branch 'master' into feature/buynow

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