Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
2f4d9e4d
Commit
2f4d9e4d
authored
Dec 08, 2019
by
Junling Bu
Browse files
perf: 团购代码优化
parent
d6f243d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/WxOrderService.java
View file @
2f4d9e4d
...
@@ -279,15 +279,21 @@ public class WxOrderService {
...
@@ -279,15 +279,21 @@ public class WxOrderService {
if
(
grouponLinkId
!=
null
&&
grouponLinkId
>
0
)
{
if
(
grouponLinkId
!=
null
&&
grouponLinkId
>
0
)
{
//团购人数已满
//团购人数已满
if
(
grouponService
.
countGroupon
(
grouponLinkId
)
>=
rules
.
getDiscountMember
()){
if
(
grouponService
.
countGroupon
(
grouponLinkId
)
>=
(
rules
.
getDiscountMember
()
-
1
)
){
return
ResponseUtil
.
fail
(
GROUPON_FULL
,
"团购活动人数已满!"
);
return
ResponseUtil
.
fail
(
GROUPON_FULL
,
"团购活动人数已满!"
);
}
}
// NOTE
// NOTE
// 这里业务方面允许用户多次开团,以及多次参团,
// 这里业务方面允许用户多次开团,以及多次参团,
// 但是不允许参加已经参加过的团购
// 但是会限制以下两点:
// (1)不允许参加已经加入的团购
if
(
grouponService
.
hasJoin
(
userId
,
grouponLinkId
)){
if
(
grouponService
.
hasJoin
(
userId
,
grouponLinkId
)){
return
ResponseUtil
.
fail
(
GROUPON_JOIN
,
"团购活动已经参加!"
);
return
ResponseUtil
.
fail
(
GROUPON_JOIN
,
"团购活动已经参加!"
);
}
}
// (2)不允许参加自己开团的团购
LitemallGroupon
groupon
=
grouponService
.
queryById
(
grouponLinkId
);
if
(
groupon
.
getCreatorUserId
().
equals
(
userId
)){
return
ResponseUtil
.
fail
(
GROUPON_JOIN
,
"团购活动已经参加!"
);
}
}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment