Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
ccbikai(👎🏻🍜)
8 years ago
Commit
4e2a08e83251803538185496bb01128f18e21318
2 parents
af03916a
df7fbdec
Merge remote-tracking branch 'origin/hotfix/seckill' into release/5.2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
72 deletions
apps/passport/models/phone-service.js
apps/product/controllers/seckill.js
apps/product/router.js
public/js/product/detail/page-render.js
public/js/product/seckill.page.js
public/js/product/tick.js
apps/passport/models/phone-service.js
View file @
4e2a08e
...
...
@@ -28,18 +28,6 @@ class PhoneService {
// 发送 验证码
// http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/发送验证码.md
static
sendSMS
(
mobile
,
area
,
type
)
{
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
resolve
({
alg
:
'SALT_MD5'
,
code
:
200
,
data
:
{},
md5
:
'6d729d4b35f10fc73531210bd7ecff91'
,
message
:
'发送成功.'
});
});
}
return
API
.
get
(
''
,
{
method
:
'app.message.sendSms'
,
mobile
,
...
...
@@ -51,20 +39,6 @@ class PhoneService {
// 校验 验证码
// http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/验证验证码.md
static
verifySMS
(
mobile
,
area
,
code
,
type
)
{
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
resolve
({
alg
:
'SALT_MD5'
,
code
:
200
,
data
:
{
is_pass
:
'Y'
},
md5
:
'6d729d4b35f10fc73531210bd7ecff91'
,
message
:
'发送成功.'
});
});
}
return
API
.
get
(
''
,
{
method
:
'app.message.verifySmsCode'
,
mobile
,
...
...
apps/product/controllers/seckill.js
View file @
4e2a08e
...
...
@@ -12,6 +12,11 @@ const mRoot = '../models';
const
headerModel
=
require
(
'../../../doraemon/models/header'
);
const
seckillModel
=
require
(
`
$
{
mRoot
}
/seckill`
)
;
let
headerData
=
headerModel
.
setNav
({
navTitle
:
'秒杀活动'
,
navBtn
:
true
,
});
/**
* [时间缺0补0]
*/
...
...
@@ -105,23 +110,21 @@ function fetchProductList(activityInfo, uid) {
/**
* [秒杀列表页面]
*/
const
index
=
(
req
,
res
,
next
)
=>
{
let
focusTime
=
Number
.
parseInt
(
req
.
query
.
time
,
10
)
||
0
;
let
headerData
=
headerModel
.
setNav
({
navTitle
:
'秒杀活动'
,
navBtn
:
true
,
const
index
=
(
req
,
res
)
=>
{
return
res
.
render
(
'seckill'
,
{
title
:
'秒杀活动'
,
pageHeader
:
headerData
,
pageStyle
:
'seckill-page'
,
pageFooter
:
true
,
width750
:
true
,
});
};
if
(
!
req
.
xhr
)
{
return
res
.
render
(
'seckill'
,
{
title
:
'秒杀活动'
,
pageHeader
:
headerData
,
pageStyle
:
'seckill-page'
,
pageFooter
:
true
,
width750
:
true
,
});
}
/**
* [秒杀列表 页面 初始数据]
*/
const
indexData
=
(
req
,
res
,
next
)
=>
{
let
focusTime
=
Number
.
parseInt
(
req
.
query
.
time
,
10
)
||
0
;
let
result
=
{};
let
uid
=
req
.
yoho
.
isApp
&&
req
.
query
.
uid
;
...
...
@@ -227,6 +230,7 @@ const index = (req, res, next) => {
res
.
json
(
result
);
});
});
};
/**
...
...
@@ -332,6 +336,7 @@ const checkAppVer = function(okVersion) {
module
.
exports
=
{
index
,
indexData
,
getProductList
,
remind
,
checkAppVer
...
...
apps/product/router.js
View file @
4e2a08e
...
...
@@ -98,6 +98,7 @@ router.get('/recommend-for-you/cart', recommendForYou.cart);
router
.
get
(
'/seckill'
,
seckill
.
checkAppVer
(
'5.1.0'
),
seckill
.
index
);
// 秒杀列表页
router
.
get
(
'/seckill/list'
,
seckill
.
indexData
);
router
.
post
(
'/seckill/remind'
,
seckill
.
remind
);
// only app; 秒杀提醒
router
.
get
(
'/seckill/get-product-list'
,
seckill
.
getProductList
);
// 秒杀列表根据活动id获取商品列表
...
...
public/js/product/detail/page-render.js
View file @
4e2a08e
...
...
@@ -18,6 +18,7 @@ module.exports = function(callback) {
productSkn
:
productSkn
},
success
:
function
(
data
)
{
// 如果当前是秒杀商品,且不在秒杀路径下,跳到该商品的秒杀详情页
var
reg
=
/
\/
product
\/
show_
([\d]
+
)
/
;
var
regPro
=
/
\/
product
\/
pro_
([\d]
+
)
_
([\d]
+
)
/
;
...
...
@@ -27,9 +28,12 @@ module.exports = function(callback) {
var
thisHref
=
window
.
location
.
href
;
var
thisRefer
=
document
.
referrer
;
if
(
regSeckill
.
test
(
thisRefer
))
{
// 如果秒杀商品没有吊牌价,显示原销售价
if
(
data
.
isSecKill
===
'Y'
&&
!
data
.
cartInfo
.
price
)
{
$
(
'.previous-price'
).
text
(
data
.
cartInfo
.
salePrice
);
}
}
else
{
if
(
!
regSeckill
.
test
(
thisRefer
))
{
if
(
data
.
isSecKill
===
'Y'
&&
(
reg
.
test
(
thisHref
)
||
regPro
.
test
(
thisHref
)))
{
window
.
location
.
replace
(
'/product/seckill/show_'
+
$
(
'#productSkn'
).
val
()
+
'.html'
);
}
...
...
public/js/product/seckill.page.js
View file @
4e2a08e
...
...
@@ -397,8 +397,7 @@ seckillObj = {
loading
.
show
();
$xhr
=
$
.
ajax
({
url
:
location
.
href
,
cache
:
false
url
:
'/product/seckill/list'
+
location
.
search
,
})
.
done
(
function
(
result
)
{
self
.
$container
.
replaceWith
(
...
...
@@ -417,6 +416,12 @@ seckillObj = {
})
.
error
(
function
()
{
self
.
$container
.
replaceWith
(
self
.
pageTemplate
({
error
:
'系统繁忙.....'
,
isApp
:
yoho
.
isApp
})
);
})
.
always
(
function
()
{
loading
.
hide
();
...
...
public/js/product/tick.js
View file @
4e2a08e
...
...
@@ -95,7 +95,6 @@ $(
// $('.current-price').show();
}
else
{
getMarketPrice
();
// 获取市场价
// 秒杀开始前
if
(
data
.
status
===
1
)
{
$
(
'.cart-bar'
).
before
(
...
...
@@ -264,32 +263,6 @@ function seckHide() {
);
}
function
getMarketPrice
()
{
var
productId
=
$
(
'#productId'
).
val
();
var
goodsId
=
$
(
'#goodsId'
).
val
();
var
productSkn
=
$
(
'#productSkn'
).
val
();
if
(
productId
&&
(
goodsId
||
productSkn
))
{
$
.
ajax
({
type
:
'POST'
,
url
:
'/product/detail/info'
,
data
:
{
id
:
productId
,
goodsId
:
goodsId
,
productSkn
:
productSkn
},
success
:
function
(
data
)
{
if
(
data
.
goodsPrice
.
previousPrice
)
{
$
(
'.previous-price'
).
text
(
data
.
goodsPrice
.
previousPrice
);
}
else
{
$
(
'.previous-price'
).
text
(
data
.
goodsPrice
.
currentPrice
);
}
}
});
}
}
function
addTimeout
(
obj
)
{
obj
.
append
(
'<div class="seckill-time seckill-time-border">'
+
...
...
Please
register
or
login
to post a comment