This commit is contained in:
GYJ 2025-02-26 17:37:29 +08:00
parent 08bb9aa48a
commit 7887d14e61
2 changed files with 10 additions and 2 deletions

View File

@ -214,9 +214,10 @@ public class InviteServiceImpl extends ServiceImpl<InviteDao, Invite> implements
user.setUserId(userId);
user.setInviterCode(userEntity.getInvitationCode());
user.setInviterUserId(userEntity.getUserId());
user.setInviteCount((userEntity.getInviteCount() == null ? 0 : userEntity.getInviteCount()) + 1);
userService.updateById(user);
userEntity.setInviteCount((user.getInviteCount() == null ? 0 : user.getInviteCount()) + 1);
// 金币
int money = Integer.parseInt(commonInfoService.findOne(911).getValue());
if (money > 0 && userEntity.getUserId() != 1) {

View File

@ -77,7 +77,11 @@ public class Tets {
@Test
public void testUserInviteCount() {
List<UserEntity> userList = userService.list(Wrappers.emptyWrapper());
System.out.println(userList.size());
int totalSize = userList.size();
System.out.println(totalSize);
AtomicInteger hasExecuteCount = new AtomicInteger();
userList.parallelStream().forEach(item -> {
try {
@ -94,6 +98,9 @@ public class Tets {
item.setInviteCount(count);
userService.updateById(item);
log.info("更新邀请人数: {}, {}", item.getUserId(), count);
hasExecuteCount.getAndIncrement();
log.info("已执行: {}/{}", hasExecuteCount, totalSize);
} catch (Exception e) {
log.error("", e);
}