Merge remote-tracking branch 'origin/hotfix/seckill' into gray
Showing
9 changed files
with
44 additions
and
79 deletions
@@ -18,7 +18,7 @@ const hotfix = require(`${cRoot}/hotfix`); | @@ -18,7 +18,7 @@ const hotfix = require(`${cRoot}/hotfix`); | ||
18 | 18 | ||
19 | // routers | 19 | // routers |
20 | 20 | ||
21 | -router.post('/upload/image', multipartMiddleware, uploadApi.uploadImg); | 21 | +router.post('/api/upload/image', multipartMiddleware, uploadApi.uploadImg); |
22 | router.post('/hf/v1', hotfix.v1); | 22 | router.post('/hf/v1', hotfix.v1); |
23 | 23 | ||
24 | module.exports = router; | 24 | module.exports = router; |
@@ -28,18 +28,6 @@ class PhoneService { | @@ -28,18 +28,6 @@ class PhoneService { | ||
28 | // 发送 验证码 | 28 | // 发送 验证码 |
29 | // http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/发送验证码.md | 29 | // http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/发送验证码.md |
30 | static sendSMS(mobile, area, type) { | 30 | static sendSMS(mobile, area, type) { |
31 | - if (process.env.NODE_ENV === 'development') { | ||
32 | - return new Promise((resolve, reject) => { | ||
33 | - return resolve({ | ||
34 | - alg: 'SALT_MD5', | ||
35 | - code: 200, | ||
36 | - data: {}, | ||
37 | - md5: '6d729d4b35f10fc73531210bd7ecff91', | ||
38 | - message: '发送成功.' | ||
39 | - }); | ||
40 | - }); | ||
41 | - } | ||
42 | - | ||
43 | return API.get('', { | 31 | return API.get('', { |
44 | method: 'app.message.sendSms', | 32 | method: 'app.message.sendSms', |
45 | mobile, | 33 | mobile, |
@@ -51,20 +39,6 @@ class PhoneService { | @@ -51,20 +39,6 @@ class PhoneService { | ||
51 | // 校验 验证码 | 39 | // 校验 验证码 |
52 | // http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/验证验证码.md | 40 | // http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/验证验证码.md |
53 | static verifySMS(mobile, area, code, type) { | 41 | static verifySMS(mobile, area, code, type) { |
54 | - if (process.env.NODE_ENV === 'development') { | ||
55 | - return new Promise((resolve, reject) => { | ||
56 | - return resolve({ | ||
57 | - alg: 'SALT_MD5', | ||
58 | - code: 200, | ||
59 | - data: { | ||
60 | - is_pass: 'Y' | ||
61 | - }, | ||
62 | - md5: '6d729d4b35f10fc73531210bd7ecff91', | ||
63 | - message: '发送成功.' | ||
64 | - }); | ||
65 | - }); | ||
66 | - } | ||
67 | - | ||
68 | return API.get('', { | 42 | return API.get('', { |
69 | method: 'app.message.verifySmsCode', | 43 | method: 'app.message.verifySmsCode', |
70 | mobile, | 44 | mobile, |
@@ -12,6 +12,11 @@ const mRoot = '../models'; | @@ -12,6 +12,11 @@ const mRoot = '../models'; | ||
12 | const headerModel = require('../../../doraemon/models/header'); | 12 | const headerModel = require('../../../doraemon/models/header'); |
13 | const seckillModel = require(`${mRoot}/seckill`); | 13 | const seckillModel = require(`${mRoot}/seckill`); |
14 | 14 | ||
15 | +let headerData = headerModel.setNav({ | ||
16 | + navTitle: '秒杀活动', | ||
17 | + navBtn: true, | ||
18 | +}); | ||
19 | + | ||
15 | /** | 20 | /** |
16 | * [时间缺0补0] | 21 | * [时间缺0补0] |
17 | */ | 22 | */ |
@@ -105,32 +110,31 @@ function fetchProductList(activityInfo, uid) { | @@ -105,32 +110,31 @@ function fetchProductList(activityInfo, uid) { | ||
105 | /** | 110 | /** |
106 | * [秒杀列表页面] | 111 | * [秒杀列表页面] |
107 | */ | 112 | */ |
108 | -const index = (req, res, next) => { | ||
109 | - let focusTime = Number.parseInt(req.query.time, 10) || 0; | ||
110 | - let headerData = headerModel.setNav({ | ||
111 | - navTitle: '秒杀活动', | ||
112 | - navBtn: true, | 113 | +const index = (req, res) => { |
114 | + return res.render('seckill', { | ||
115 | + title: '秒杀活动', | ||
116 | + pageHeader: headerData, | ||
117 | + pageStyle: 'seckill-page', | ||
118 | + pageFooter: true, | ||
119 | + width750: true, | ||
113 | }); | 120 | }); |
121 | +}; | ||
114 | 122 | ||
115 | - if (!req.xhr) { | ||
116 | - return res.render('seckill', { | ||
117 | - title: '秒杀活动', | ||
118 | - pageHeader: headerData, | ||
119 | - pageStyle: 'seckill-page', | ||
120 | - pageFooter: true, | ||
121 | - width750: true, | ||
122 | - }); | ||
123 | - } | ||
124 | - | 123 | +/** |
124 | + * [秒杀列表 页面 初始数据] | ||
125 | + */ | ||
126 | +const indexData = (req, res, next) => { | ||
127 | + let focusTime = Number.parseInt(req.query.time, 10) || 0; | ||
125 | let result = {}; | 128 | let result = {}; |
126 | let uid = req.yoho.isApp && req.query.uid; | 129 | let uid = req.yoho.isApp && req.query.uid; |
127 | 130 | ||
128 | return seckillModel.queryActivity().then((resultActivity) => { | 131 | return seckillModel.queryActivity().then((resultActivity) => { |
129 | // console.log(resultActivity) | 132 | // console.log(resultActivity) |
130 | let focusIndex = false; | 133 | let focusIndex = false; |
134 | + | ||
131 | // let nowTime = Date.now(); | 135 | // let nowTime = Date.now(); |
132 | if (!resultActivity.data) { | 136 | if (!resultActivity.data) { |
133 | - return next(); | 137 | + return next(); |
134 | } | 138 | } |
135 | result.currentTime = resultActivity.data.currentTime * 1000; | 139 | result.currentTime = resultActivity.data.currentTime * 1000; |
136 | if (resultActivity.code !== 200) { | 140 | if (resultActivity.code !== 200) { |
@@ -226,6 +230,7 @@ const index = (req, res, next) => { | @@ -226,6 +230,7 @@ const index = (req, res, next) => { | ||
226 | res.json(result); | 230 | res.json(result); |
227 | }); | 231 | }); |
228 | }); | 232 | }); |
233 | + | ||
229 | }; | 234 | }; |
230 | 235 | ||
231 | /** | 236 | /** |
@@ -331,6 +336,7 @@ const checkAppVer = function(okVersion) { | @@ -331,6 +336,7 @@ const checkAppVer = function(okVersion) { | ||
331 | 336 | ||
332 | module.exports = { | 337 | module.exports = { |
333 | index, | 338 | index, |
339 | + indexData, | ||
334 | getProductList, | 340 | getProductList, |
335 | remind, | 341 | remind, |
336 | checkAppVer | 342 | checkAppVer |
@@ -95,6 +95,7 @@ router.get('/recommend-for-you/cart', recommendForYou.cart); | @@ -95,6 +95,7 @@ router.get('/recommend-for-you/cart', recommendForYou.cart); | ||
95 | 95 | ||
96 | 96 | ||
97 | router.get('/seckill', seckill.checkAppVer('5.1.0'), seckill.index); // 秒杀列表页 | 97 | router.get('/seckill', seckill.checkAppVer('5.1.0'), seckill.index); // 秒杀列表页 |
98 | +router.get('/seckill/list', seckill.indexData); | ||
98 | 99 | ||
99 | router.post('/seckill/remind', seckill.remind); // only app; 秒杀提醒 | 100 | router.post('/seckill/remind', seckill.remind); // only app; 秒杀提醒 |
100 | router.get('/seckill/get-product-list', seckill.getProductList); // 秒杀列表根据活动id获取商品列表 | 101 | router.get('/seckill/get-product-list', seckill.getProductList); // 秒杀列表根据活动id获取商品列表 |
@@ -11,9 +11,9 @@ module.exports = app => { | @@ -11,9 +11,9 @@ module.exports = app => { | ||
11 | // 四个频道页,频道选择页面 /boys,/girls,/,/kids,/lifestyle 等页面,就直接占用路由了 | 11 | // 四个频道页,频道选择页面 /boys,/girls,/,/kids,/lifestyle 等页面,就直接占用路由了 |
12 | app.use(require('./apps/channel')); | 12 | app.use(require('./apps/channel')); |
13 | app.use(require('./apps/passport')); | 13 | app.use(require('./apps/passport')); |
14 | + app.use(require('./apps/api')); // 一些只返回json的通用api | ||
14 | 15 | ||
15 | // 业务模块 | 16 | // 业务模块 |
16 | - app.use('/api', require('./apps/api')); // 各模块公有 API | ||
17 | app.use('/product', require('./apps/product')); | 17 | app.use('/product', require('./apps/product')); |
18 | app.use('/guang', require('./apps/guang')); | 18 | app.use('/guang', require('./apps/guang')); |
19 | app.use('/activity', require('./apps/activity')); | 19 | app.use('/activity', require('./apps/activity')); |
@@ -21,7 +21,4 @@ module.exports = app => { | @@ -21,7 +21,4 @@ module.exports = app => { | ||
21 | 21 | ||
22 | // 分期付款 | 22 | // 分期付款 |
23 | app.use('/home', require('./apps/home')); | 23 | app.use('/home', require('./apps/home')); |
24 | - | ||
25 | - // 一些只返回json的通用api | ||
26 | - app.use('/', require('./apps/api')); | ||
27 | }; | 24 | }; |
@@ -78,7 +78,11 @@ function render(data) { | @@ -78,7 +78,11 @@ function render(data) { | ||
78 | $chosePanel.find('.text-info>.name').text(cartInfo.name); | 78 | $chosePanel.find('.text-info>.name').text(cartInfo.name); |
79 | $chosePanel.find('.sale-price').text(cartInfo.salePrice); | 79 | $chosePanel.find('.sale-price').text(cartInfo.salePrice); |
80 | if (!cartInfo.price) { | 80 | if (!cartInfo.price) { |
81 | - $chosePanel.find('.sale-price').addClass('no-price'); | 81 | + if (data.isSecKill === 'Y') { |
82 | + $('.price').append('<span class="market-price">' + cartInfo.salePrice + '</span>'); | ||
83 | + } else { | ||
84 | + $chosePanel.find('.sale-price').addClass('no-price'); | ||
85 | + } | ||
82 | } else { | 86 | } else { |
83 | $chosePanel.find('.market-price').text(cartInfo.price).removeClass(dbClass); | 87 | $chosePanel.find('.market-price').text(cartInfo.price).removeClass(dbClass); |
84 | } | 88 | } |
@@ -18,6 +18,7 @@ module.exports = function(callback) { | @@ -18,6 +18,7 @@ module.exports = function(callback) { | ||
18 | productSkn: productSkn | 18 | productSkn: productSkn |
19 | }, | 19 | }, |
20 | success: function(data) { | 20 | success: function(data) { |
21 | + | ||
21 | // 如果当前是秒杀商品,且不在秒杀路径下,跳到该商品的秒杀详情页 | 22 | // 如果当前是秒杀商品,且不在秒杀路径下,跳到该商品的秒杀详情页 |
22 | var reg = /\/product\/show_([\d]+)/; | 23 | var reg = /\/product\/show_([\d]+)/; |
23 | var regPro = /\/product\/pro_([\d]+)_([\d]+)/; | 24 | var regPro = /\/product\/pro_([\d]+)_([\d]+)/; |
@@ -27,9 +28,12 @@ module.exports = function(callback) { | @@ -27,9 +28,12 @@ module.exports = function(callback) { | ||
27 | var thisHref = window.location.href; | 28 | var thisHref = window.location.href; |
28 | var thisRefer = document.referrer; | 29 | var thisRefer = document.referrer; |
29 | 30 | ||
30 | - if (regSeckill.test(thisRefer)) { | 31 | + // 如果秒杀商品没有吊牌价,显示原销售价 |
32 | + if (data.isSecKill === 'Y' && !data.cartInfo.price) { | ||
33 | + $('.previous-price').text(data.cartInfo.salePrice); | ||
34 | + } | ||
31 | 35 | ||
32 | - } else { | 36 | + if (!regSeckill.test(thisRefer)) { |
33 | if (data.isSecKill === 'Y' && (reg.test(thisHref) || regPro.test(thisHref))) { | 37 | if (data.isSecKill === 'Y' && (reg.test(thisHref) || regPro.test(thisHref))) { |
34 | window.location.replace('/product/seckill/show_' + $('#productSkn').val() + '.html'); | 38 | window.location.replace('/product/seckill/show_' + $('#productSkn').val() + '.html'); |
35 | } | 39 | } |
@@ -397,8 +397,7 @@ seckillObj = { | @@ -397,8 +397,7 @@ seckillObj = { | ||
397 | 397 | ||
398 | loading.show(); | 398 | loading.show(); |
399 | $xhr = $.ajax({ | 399 | $xhr = $.ajax({ |
400 | - url: location.href, | ||
401 | - cache: false | 400 | + url: '/product/seckill/list' + location.search, |
402 | }) | 401 | }) |
403 | .done(function(result) { | 402 | .done(function(result) { |
404 | self.$container.replaceWith( | 403 | self.$container.replaceWith( |
@@ -417,6 +416,12 @@ seckillObj = { | @@ -417,6 +416,12 @@ seckillObj = { | ||
417 | 416 | ||
418 | }) | 417 | }) |
419 | .error(function() { | 418 | .error(function() { |
419 | + self.$container.replaceWith( | ||
420 | + self.pageTemplate({ | ||
421 | + error: '系统繁忙.....', | ||
422 | + isApp: yoho.isApp | ||
423 | + }) | ||
424 | + ); | ||
420 | }) | 425 | }) |
421 | .always(function() { | 426 | .always(function() { |
422 | loading.hide(); | 427 | loading.hide(); |
@@ -74,6 +74,7 @@ seckillObj = { | @@ -74,6 +74,7 @@ seckillObj = { | ||
74 | 74 | ||
75 | $( | 75 | $( |
76 | function() { | 76 | function() { |
77 | + $('#goodsDiscount').hide();// 隐藏折扣楼层 | ||
77 | $('.cart-bar').hide(); | 78 | $('.cart-bar').hide(); |
78 | $('.current-price').hide(); | 79 | $('.current-price').hide(); |
79 | var ajaxUrl = '/product/seckillDetail/seckillData/' + $('#productSkn').val(); | 80 | var ajaxUrl = '/product/seckillDetail/seckillData/' + $('#productSkn').val(); |
@@ -94,7 +95,6 @@ $( | @@ -94,7 +95,6 @@ $( | ||
94 | // $('.current-price').show(); | 95 | // $('.current-price').show(); |
95 | } else { | 96 | } else { |
96 | 97 | ||
97 | - getMarketPrice();// 获取市场价 | ||
98 | // 秒杀开始前 | 98 | // 秒杀开始前 |
99 | if (data.status === 1) { | 99 | if (data.status === 1) { |
100 | $('.cart-bar').before( | 100 | $('.cart-bar').before( |
@@ -263,32 +263,6 @@ function seckHide() { | @@ -263,32 +263,6 @@ function seckHide() { | ||
263 | ); | 263 | ); |
264 | } | 264 | } |
265 | 265 | ||
266 | -function getMarketPrice() { | ||
267 | - var productId = $('#productId').val(); | ||
268 | - var goodsId = $('#goodsId').val(); | ||
269 | - var productSkn = $('#productSkn').val(); | ||
270 | - | ||
271 | - if (productId && (goodsId || productSkn)) { | ||
272 | - $.ajax({ | ||
273 | - type: 'POST', | ||
274 | - url: '/product/detail/info', | ||
275 | - data: { | ||
276 | - id: productId, | ||
277 | - goodsId: goodsId, | ||
278 | - productSkn: productSkn | ||
279 | - }, | ||
280 | - success: function(data) { | ||
281 | - if (data.goodsPrice.previousPrice) { | ||
282 | - $('.previous-price').text(data.goodsPrice.previousPrice); | ||
283 | - } else { | ||
284 | - $('.previous-price').text(data.goodsPrice.currentPrice); | ||
285 | - } | ||
286 | - | ||
287 | - } | ||
288 | - }); | ||
289 | - } | ||
290 | -} | ||
291 | - | ||
292 | function addTimeout(obj) { | 266 | function addTimeout(obj) { |
293 | obj.append( | 267 | obj.append( |
294 | '<div class="seckill-time seckill-time-border">' + | 268 | '<div class="seckill-time seckill-time-border">' + |
-
Please register or login to post a comment