Merge remote-tracking branch 'origin/hotfix/seckill' into release/5.2
Showing
6 changed files
with
28 additions
and
66 deletions
@@ -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,14 +110,7 @@ function fetchProductList(activityInfo, uid) { | @@ -105,14 +110,7 @@ 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 | - }); | ||
114 | - | ||
115 | - if (!req.xhr) { | 113 | +const index = (req, res) => { |
116 | return res.render('seckill', { | 114 | return res.render('seckill', { |
117 | title: '秒杀活动', | 115 | title: '秒杀活动', |
118 | pageHeader: headerData, | 116 | pageHeader: headerData, |
@@ -120,8 +118,13 @@ const index = (req, res, next) => { | @@ -120,8 +118,13 @@ const index = (req, res, next) => { | ||
120 | pageFooter: true, | 118 | pageFooter: true, |
121 | width750: true, | 119 | width750: true, |
122 | }); | 120 | }); |
123 | - } | 121 | +}; |
124 | 122 | ||
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 | ||
@@ -227,6 +230,7 @@ const index = (req, res, next) => { | @@ -227,6 +230,7 @@ const index = (req, res, next) => { | ||
227 | res.json(result); | 230 | res.json(result); |
228 | }); | 231 | }); |
229 | }); | 232 | }); |
233 | + | ||
230 | }; | 234 | }; |
231 | 235 | ||
232 | /** | 236 | /** |
@@ -332,6 +336,7 @@ const checkAppVer = function(okVersion) { | @@ -332,6 +336,7 @@ const checkAppVer = function(okVersion) { | ||
332 | 336 | ||
333 | module.exports = { | 337 | module.exports = { |
334 | index, | 338 | index, |
339 | + indexData, | ||
335 | getProductList, | 340 | getProductList, |
336 | remind, | 341 | remind, |
337 | checkAppVer | 342 | checkAppVer |
@@ -98,6 +98,7 @@ router.get('/recommend-for-you/cart', recommendForYou.cart); | @@ -98,6 +98,7 @@ router.get('/recommend-for-you/cart', recommendForYou.cart); | ||
98 | 98 | ||
99 | 99 | ||
100 | router.get('/seckill', seckill.checkAppVer('5.1.0'), seckill.index); // 秒杀列表页 | 100 | router.get('/seckill', seckill.checkAppVer('5.1.0'), seckill.index); // 秒杀列表页 |
101 | +router.get('/seckill/list', seckill.indexData); | ||
101 | 102 | ||
102 | router.post('/seckill/remind', seckill.remind); // only app; 秒杀提醒 | 103 | router.post('/seckill/remind', seckill.remind); // only app; 秒杀提醒 |
103 | router.get('/seckill/get-product-list', seckill.getProductList); // 秒杀列表根据活动id获取商品列表 | 104 | router.get('/seckill/get-product-list', seckill.getProductList); // 秒杀列表根据活动id获取商品列表 |
@@ -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(); |
@@ -95,7 +95,6 @@ $( | @@ -95,7 +95,6 @@ $( | ||
95 | // $('.current-price').show(); | 95 | // $('.current-price').show(); |
96 | } else { | 96 | } else { |
97 | 97 | ||
98 | - getMarketPrice();// 获取市场价 | ||
99 | // 秒杀开始前 | 98 | // 秒杀开始前 |
100 | if (data.status === 1) { | 99 | if (data.status === 1) { |
101 | $('.cart-bar').before( | 100 | $('.cart-bar').before( |
@@ -264,32 +263,6 @@ function seckHide() { | @@ -264,32 +263,6 @@ function seckHide() { | ||
264 | ); | 263 | ); |
265 | } | 264 | } |
266 | 265 | ||
267 | -function getMarketPrice() { | ||
268 | - var productId = $('#productId').val(); | ||
269 | - var goodsId = $('#goodsId').val(); | ||
270 | - var productSkn = $('#productSkn').val(); | ||
271 | - | ||
272 | - if (productId && (goodsId || productSkn)) { | ||
273 | - $.ajax({ | ||
274 | - type: 'POST', | ||
275 | - url: '/product/detail/info', | ||
276 | - data: { | ||
277 | - id: productId, | ||
278 | - goodsId: goodsId, | ||
279 | - productSkn: productSkn | ||
280 | - }, | ||
281 | - success: function(data) { | ||
282 | - if (data.goodsPrice.previousPrice) { | ||
283 | - $('.previous-price').text(data.goodsPrice.previousPrice); | ||
284 | - } else { | ||
285 | - $('.previous-price').text(data.goodsPrice.currentPrice); | ||
286 | - } | ||
287 | - | ||
288 | - } | ||
289 | - }); | ||
290 | - } | ||
291 | -} | ||
292 | - | ||
293 | function addTimeout(obj) { | 266 | function addTimeout(obj) { |
294 | obj.append( | 267 | obj.append( |
295 | '<div class="seckill-time seckill-time-border">' + | 268 | '<div class="seckill-time seckill-time-border">' + |
-
Please register or login to post a comment