|
|
@@ -245,6 +245,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
if (sharedId != null && dsType != null && dsType == 2) {
|
|
|
equipDistributeService.saveDistributionInvitation(sharedId, isNewUser, user.getId());
|
|
|
}
|
|
|
+ //查找渠道是否有设置了对应的claude code优惠码
|
|
|
+ setClaudeCodePopularize(sharedId, dsPopularizeId, user);
|
|
|
//每日活跃记录
|
|
|
userLoginRecordService.saveUserLoginDayRecord(user.getId());
|
|
|
//是否是大学生快递站进来的用户
|
|
|
@@ -598,31 +600,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
equipDistributeService.saveDistributionInvitation(sharedId, isNewUser, user.getId());
|
|
|
}
|
|
|
//查找渠道是否有设置了对应的claude code优惠码
|
|
|
- if (sharedId != null) {
|
|
|
- UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class).eq(UserDistribute::getUserId, sharedId).eq(UserDistribute::getDeleted, Boolean.TRUE).last("limit 1"));
|
|
|
- if (userDistribute != null) {
|
|
|
- Integer selectCount = couponDistributePopularizeMapper.selectCount(Wrappers.lambdaQuery(CouponDistributePopularize.class).eq(CouponDistributePopularize::getDistributeId, userDistribute.getId()).eq(CouponDistributePopularize::getDeleted, Boolean.TRUE).eq(CouponDistributePopularize::getCouponId, Constant.DISTRIBUTE_CLAUDE_CODE_COUPON_ID));
|
|
|
- //是否设置claude cod优惠券
|
|
|
- if (selectCount > 0) {
|
|
|
- //设置了 直接发送优惠券
|
|
|
- couponCommonService.sendCouponToUser(user.getId(), Constant.DISTRIBUTE_CLAUDE_CODE_COUPON_ID, 0l, 0l, dsPopularizeId, CouponUser.Channel.manual);
|
|
|
- if (redisService.setNx(RedisService.key.CLAUDE_CODE_TY_DAY_CARD_KEY.getName() + user.getId(), user.getId(), RedisService.key.CLAUDE_CODE_TY_DAY_CARD_KEY.getTimeout())) {
|
|
|
- //存在Claude code车票不发送体验卡
|
|
|
- if (!claudeCodeService.checkClaudeCodeUser(user.getId())) {
|
|
|
- //发送claude code 体验卡
|
|
|
- groupRelationFrontService.getTrialTicketByUserIdAndGoodsId(user.getId(), Constant.DISTRIBUTE_CLAUDE_CODE_TRIAL_SKU_ID, 1);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- //该优惠券是否处于推荐中
|
|
|
- int isTj = couponRecommendMapper.checkPresentRecommendByCouponId(Constant.DISTRIBUTE_CLAUDE_CODE_NO_CODE_COUPON_ID);
|
|
|
- if (isTj != 0) {
|
|
|
- //发送无优惠码的 优惠券
|
|
|
- couponCommonService.sendCouponToUser(user.getId(), Constant.DISTRIBUTE_CLAUDE_CODE_NO_CODE_COUPON_ID, 0l, 0l, dsPopularizeId, CouponUser.Channel.manual);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ setClaudeCodePopularize(sharedId, dsPopularizeId, user);
|
|
|
|
|
|
//每日活跃记录
|
|
|
userLoginRecordService.saveUserLoginDayRecord(user.getId());
|
|
|
@@ -962,4 +940,36 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
} catch (DuplicateKeyException e) {
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查找渠道是否有设置了对应的claude code优惠码
|
|
|
+ */
|
|
|
+ public void setClaudeCodePopularize(Long sharedId, Long dsPopularizeId, User user) {
|
|
|
+ //查找渠道是否有设置了对应的claude code优惠码
|
|
|
+ if (sharedId != null) {
|
|
|
+ UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class).eq(UserDistribute::getUserId, sharedId).eq(UserDistribute::getDeleted, Boolean.TRUE).last("limit 1"));
|
|
|
+ if (userDistribute != null) {
|
|
|
+ Integer selectCount = couponDistributePopularizeMapper.selectCount(Wrappers.lambdaQuery(CouponDistributePopularize.class).eq(CouponDistributePopularize::getDistributeId, userDistribute.getId()).eq(CouponDistributePopularize::getDeleted, Boolean.TRUE).eq(CouponDistributePopularize::getCouponId, Constant.DISTRIBUTE_CLAUDE_CODE_COUPON_ID));
|
|
|
+ //是否设置claude cod优惠券
|
|
|
+ if (selectCount > 0) {
|
|
|
+ //设置了 直接发送优惠券
|
|
|
+ couponCommonService.sendCouponToUser(user.getId(), Constant.DISTRIBUTE_CLAUDE_CODE_COUPON_ID, 0l, 0l, dsPopularizeId, CouponUser.Channel.manual);
|
|
|
+ if (redisService.setNx(RedisService.key.CLAUDE_CODE_TY_DAY_CARD_KEY.getName() + user.getId(), user.getId(), RedisService.key.CLAUDE_CODE_TY_DAY_CARD_KEY.getTimeout())) {
|
|
|
+ //存在Claude code车票不发送体验卡
|
|
|
+ if (!claudeCodeService.checkClaudeCodeUser(user.getId())) {
|
|
|
+ //发送claude code 体验卡
|
|
|
+ groupRelationFrontService.getTrialTicketByUserIdAndGoodsId(user.getId(), Constant.DISTRIBUTE_CLAUDE_CODE_TRIAL_SKU_ID, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //该优惠券是否处于推荐中
|
|
|
+ int isTj = couponRecommendMapper.checkPresentRecommendByCouponId(Constant.DISTRIBUTE_CLAUDE_CODE_NO_CODE_COUPON_ID);
|
|
|
+ if (isTj != 0) {
|
|
|
+ //发送无优惠码的 优惠券
|
|
|
+ couponCommonService.sendCouponToUser(user.getId(), Constant.DISTRIBUTE_CLAUDE_CODE_NO_CODE_COUPON_ID, 0l, 0l, dsPopularizeId, CouponUser.Channel.manual);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|