Commit 2f4d9e4d authored by Junling Bu's avatar Junling Bu
Browse files

perf: 团购代码优化

parent d6f243d8
......@@ -279,15 +279,21 @@ public class WxOrderService {
if (grouponLinkId != null && grouponLinkId > 0) {
//团购人数已满
if(grouponService.countGroupon(grouponLinkId) >= rules.getDiscountMember()){
if(grouponService.countGroupon(grouponLinkId) >= (rules.getDiscountMember() - 1)){
return ResponseUtil.fail(GROUPON_FULL, "团购活动人数已满!");
}
// NOTE
// 这里业务方面允许用户多次开团,以及多次参团,
// 但是不允许参加已经参加过的团购
// 但是会限制以下两点:
// (1)不允许参加已经加入的团购
if(grouponService.hasJoin(userId, grouponLinkId)){
return ResponseUtil.fail(GROUPON_JOIN, "团购活动已经参加!");
}
// (2)不允许参加自己开团的团购
LitemallGroupon groupon = grouponService.queryById(grouponLinkId);
if(groupon.getCreatorUserId().equals(userId)){
return ResponseUtil.fail(GROUPON_JOIN, "团购活动已经参加!");
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment