fix(auth): 添加用户主题批量删除接口放行

feat(user): 注册用户时初始化钱包
This commit is contained in:
2025-12-11 19:50:19 +08:00
parent 5121bf3455
commit 360ac7a885
2 changed files with 19 additions and 1 deletions

View File

@@ -92,7 +92,8 @@ public class SaTokenConfigure implements WebMvcConfigurer {
"/themes/purchased",
"/themes/purchase/list",
"/themes/detail",
"/themes/recommended"
"/themes/recommended",
"/user-themes/batch-delete"
};
}
@Bean

View File

@@ -12,8 +12,10 @@ import com.yolo.keyborad.exception.BusinessException;
import com.yolo.keyborad.mapper.KeyboardUserMapper;
import com.yolo.keyborad.model.dto.user.*;
import com.yolo.keyborad.model.entity.KeyboardUser;
import com.yolo.keyborad.model.entity.KeyboardUserWallet;
import com.yolo.keyborad.model.vo.user.KeyboardUserRespVO;
import com.yolo.keyborad.service.KeyboardCharacterService;
import com.yolo.keyborad.service.KeyboardUserWalletService;
import com.yolo.keyborad.service.UserService;
import com.yolo.keyborad.utils.RedisUtil;
import com.yolo.keyborad.utils.SendMailUtils;
@@ -26,6 +28,8 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/*
@@ -51,6 +55,9 @@ public class UserServiceImpl extends ServiceImpl<KeyboardUserMapper, KeyboardUse
@Resource
private KeyboardCharacterService keyboardCharacterService;
@Resource
private KeyboardUserWalletService walletService;
@Override
public KeyboardUser selectUserWithSubjectId(String sub) {
return keyboardUserMapper.selectOne(
@@ -140,6 +147,16 @@ public class UserServiceImpl extends ServiceImpl<KeyboardUserMapper, KeyboardUse
int insertCount = keyboardUserMapper.insert(keyboardUser);
if (insertCount > 0) {
keyboardCharacterService.addDefaultUserCharacter(keyboardUser.getId());
// 初始化用户钱包
KeyboardUserWallet wallet = new KeyboardUserWallet();
wallet.setUserId(keyboardUser.getId());
wallet.setBalance(BigDecimal.ZERO);
wallet.setVersion(0);
wallet.setStatus((short) 1);
wallet.setCreatedAt(new Date());
wallet.setUpdatedAt(new Date());
walletService.save(wallet);
}
return insertCount > 0;
}