|
|
@@ -32,9 +32,6 @@ public class ActivityInviteConfigServiceImpl extends ServiceImpl<ActivityInviteC
|
|
|
|
|
|
private final ActivityInviteLogMapper activityInviteLogMapper;
|
|
|
|
|
|
- private final LifeDiscountCouponMapper lifeDiscountCouponMapper;
|
|
|
-
|
|
|
- private final LifeDiscountCouponUserMapper LifeDiscountCouponUser;
|
|
|
|
|
|
@Override
|
|
|
public String bindInviteCode(Integer invitedUserId, String inviteCode) {
|
|
|
@@ -97,18 +94,12 @@ public class ActivityInviteConfigServiceImpl extends ServiceImpl<ActivityInviteC
|
|
|
activityInviteLog.setInvitedRewardPoint(activityInviteConfig.getInvitedRewardPoint());
|
|
|
activityInviteLog.setInviteTime(Date.from(Instant.now()));
|
|
|
activityInviteLogMapper.insert(activityInviteLog);
|
|
|
- int inviteCondition = activityInviteConfig.getInviteCondition();
|
|
|
- if(inviteCondition == 1){
|
|
|
- if(activityInviteConfig.getInviteRewardType() == 2){
|
|
|
- userPointService.addPoint(inviteUserId, activityInviteConfig.getInviteRewardPoint());
|
|
|
- } else if(activityInviteConfig.getInviteRewardType() == 1 && activityInviteConfig.getInviteRewardCoupon() > 0){
|
|
|
- issuePlatformCoupon(inviteUserId, activityInviteConfig.getInviteRewardCoupon());
|
|
|
- }
|
|
|
- if(activityInviteConfig.getInvitedRewardType() == 2){
|
|
|
- userPointService.addPoint(invitedUserId, activityInviteConfig.getInvitedRewardPoint());
|
|
|
- } else if (activityInviteConfig.getInvitedRewardType() == 1 && activityInviteConfig.getInvitedRewardCoupon() > 0) {
|
|
|
- issuePlatformCoupon(invitedUserId, activityInviteConfig.getInvitedRewardCoupon());
|
|
|
- }
|
|
|
+
|
|
|
+ if (activityInviteConfig.getInviteRewardType() == 2) {
|
|
|
+ userPointService.addPoint(inviteUserId, activityInviteConfig.getInviteRewardPoint());
|
|
|
+ }
|
|
|
+ if (activityInviteConfig.getInvitedRewardType() == 2) {
|
|
|
+ userPointService.addPoint(invitedUserId, activityInviteConfig.getInvitedRewardPoint());
|
|
|
}
|
|
|
LifeUser updateLifeUser = new LifeUser();
|
|
|
updateLifeUser.setId(invitedLifeUser.getId());
|
|
|
@@ -122,21 +113,4 @@ public class ActivityInviteConfigServiceImpl extends ServiceImpl<ActivityInviteC
|
|
|
}
|
|
|
return "参数异常";
|
|
|
}
|
|
|
-
|
|
|
- public void issuePlatformCoupon(Integer userId, Integer couponId) {
|
|
|
- LifeDiscountCoupon lifeDiscountCoupon = lifeDiscountCouponMapper.selectById(couponId);
|
|
|
- if(lifeDiscountCoupon == null){
|
|
|
- //如果优惠券为空,则返回失败
|
|
|
- return;
|
|
|
- }
|
|
|
- LifeDiscountCouponUser lifeDiscountCouponUser = new LifeDiscountCouponUser();
|
|
|
- lifeDiscountCouponUser.setUserId(userId);
|
|
|
- lifeDiscountCouponUser.setCouponId(couponId);
|
|
|
- lifeDiscountCouponUser.setReceiveTime(new Date());
|
|
|
- lifeDiscountCouponUser.setExpirationTime(LocalDate.now().plusDays(Long.parseLong(lifeDiscountCoupon.getSpecifiedDay())));
|
|
|
- lifeDiscountCouponUser.setStatus(0);
|
|
|
- lifeDiscountCouponUser.setDeleteFlag(0);
|
|
|
- lifeDiscountCouponUser.setCreatedTime(new Date());
|
|
|
- LifeDiscountCouponUser.insert(lifeDiscountCouponUser);
|
|
|
- }
|
|
|
}
|