123
This commit is contained in:
@@ -11,10 +11,7 @@ import com.ruoyi.cai.enums.account.AccountChangeCodeEnum;
|
||||
import com.ruoyi.cai.executor.ExecutorConstant;
|
||||
import com.ruoyi.cai.mapper.AccountMapper;
|
||||
import com.ruoyi.cai.notice.YunxinHttpService;
|
||||
import com.ruoyi.cai.service.AccountChangeLogService;
|
||||
import com.ruoyi.cai.service.RankService;
|
||||
import com.ruoyi.cai.service.UserInfoService;
|
||||
import com.ruoyi.cai.service.UserService;
|
||||
import com.ruoyi.cai.service.*;
|
||||
import com.ruoyi.cai.util.CaiDateUtil;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -44,6 +41,8 @@ public class AwardManager {
|
||||
private RankService rankService;
|
||||
@Autowired
|
||||
private YunxinHttpService yunxinHttpService;
|
||||
@Autowired
|
||||
private UserInviteService userInviteService;
|
||||
|
||||
public void giveJoinAnchorAsync(Long anchorUserId){
|
||||
AwardManager bean = SpringUtil.getBean(AwardManager.class);
|
||||
@@ -74,6 +73,7 @@ public class AwardManager {
|
||||
return;
|
||||
}
|
||||
accountMapper.incsIncomeCoin(inviteUser.getId(),price);
|
||||
userInviteService.incsCoin(inviteUser.getId(),anchorUserId,price);
|
||||
accountChangeLogService.saveLogNoAdmin(inviteUser.getId(),inviteUser.getUsercode(), AccountChangeCodeEnum.JOIN_ANCHOR_INVITE,price,null,anchorUserId);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,5 +24,13 @@ public interface UserInviteService extends IService<UserInvite> {
|
||||
|
||||
Page<UserInviteAdminVo> pageAdmin(PageQuery pageQuery, UserInviteAdminVo bo);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param geUserId 邀请人 收到奖励的人
|
||||
* @param seUserId 来源人 获取奖励的人
|
||||
* @param amount 创造的收益
|
||||
*/
|
||||
void incsCoinAsync(Long geUserId, Long seUserId, Long amount);
|
||||
|
||||
void incsCoin(Long geUserId, Long seUserId, Long amount);
|
||||
}
|
||||
|
||||
@@ -92,20 +92,23 @@ public class UserInviteServiceImpl extends ServiceImpl<UserInviteMapper, UserInv
|
||||
*/
|
||||
@Override
|
||||
public void incsCoinAsync(Long geUserId, Long seUserId, Long amount) {
|
||||
ExecutorConstant.COMMON_EXECUTOR.execute(() -> {
|
||||
if(geUserId == null || seUserId == null || amount == null || amount <= 0){
|
||||
log.error("执行收益的递增失败【参数异常】");
|
||||
return;
|
||||
}
|
||||
UserInvite one = this.getOne(Wrappers.lambdaQuery(UserInvite.class)
|
||||
.eq(UserInvite::getInviteId, geUserId)
|
||||
.eq(UserInvite::getUserId, seUserId));
|
||||
if(one == null){
|
||||
log.error("执行收益的递增失败");
|
||||
return;
|
||||
}
|
||||
baseMapper.incsCoinTotal(one.getId(),amount);
|
||||
});
|
||||
ExecutorConstant.COMMON_EXECUTOR.execute(() -> incsCoin(geUserId,seUserId,amount));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incsCoin(Long geUserId, Long seUserId, Long amount){
|
||||
if(geUserId == null || seUserId == null || amount == null || amount <= 0){
|
||||
log.error("执行收益的递增失败【参数异常】");
|
||||
return;
|
||||
}
|
||||
UserInvite one = this.getOne(Wrappers.lambdaQuery(UserInvite.class)
|
||||
.eq(UserInvite::getInviteId, geUserId)
|
||||
.eq(UserInvite::getUserId, seUserId));
|
||||
if(one == null){
|
||||
log.error("执行收益的递增失败");
|
||||
return;
|
||||
}
|
||||
baseMapper.incsCoinTotal(one.getId(),amount);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user