From f95762138bacca5ce4ab1cd27acafc82eb38d85c Mon Sep 17 00:00:00 2001 From: ziin Date: Tue, 16 Dec 2025 17:54:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(quota):=20=E6=96=B0=E5=A2=9E=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=A2=9D=E5=BA=A6=E6=80=BB=E8=AE=A1=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7=E5=85=8D=E8=B4=B9?= =?UTF-8?q?=E4=BD=93=E9=AA=8C=E9=A2=9D=E5=BA=A6=E9=85=8D=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=96=B0=E7=94=A8=E6=88=B7=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E9=A2=9D=E5=BA=A6=E5=88=86=E9=85=8D=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/UserRegisterProperties.java | 20 ++++++++++ .../service/impl/UserServiceImpl.java | 38 ++++++++++++++++++- src/main/resources/application-dev.yml | 4 +- src/main/resources/application-prod.yml | 4 +- 4 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/yolo/keyborad/config/UserRegisterProperties.java diff --git a/src/main/java/com/yolo/keyborad/config/UserRegisterProperties.java b/src/main/java/com/yolo/keyborad/config/UserRegisterProperties.java new file mode 100644 index 0000000..dc57d07 --- /dev/null +++ b/src/main/java/com/yolo/keyborad/config/UserRegisterProperties.java @@ -0,0 +1,20 @@ +package com.yolo.keyborad.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 用户注册配置属性 + */ +@ConfigurationProperties(prefix = "user.register") +@Component +@Data +public class UserRegisterProperties { + + /** + * 新用户注册时的免费使用次数 + */ + private Integer freeTrialQuota = 5; + +} diff --git a/src/main/java/com/yolo/keyborad/service/impl/UserServiceImpl.java b/src/main/java/com/yolo/keyborad/service/impl/UserServiceImpl.java index 7a31c50..37fd499 100644 --- a/src/main/java/com/yolo/keyborad/service/impl/UserServiceImpl.java +++ b/src/main/java/com/yolo/keyborad/service/impl/UserServiceImpl.java @@ -60,6 +60,12 @@ public class UserServiceImpl extends ServiceImpl 0) { keyboardCharacterService.addDefaultUserCharacter(keyboardUser.getId()); - // 初始化用户钱包 + // 初始化用户钱包(余额为0) KeyboardUserWallet wallet = new KeyboardUserWallet(); wallet.setUserId(keyboardUser.getId()); wallet.setBalance(BigDecimal.ZERO); @@ -210,6 +230,20 @@ public class UserServiceImpl extends ServiceImpl 0; } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 3971298..1542905 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -79,8 +79,8 @@ mailgun: # 用户注册配置 user: register: - # 新用户注册时的免费体验额度 - free-trial-credits: 5 + # 新用户注册时的免费使用次数 + free-trial-quota: 5 diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 383137a..14592f2 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -32,5 +32,5 @@ logging: # 用户注册配置 user: register: - # 新用户注册时的免费体验额度 - free-trial-credits: 5 + # 新用户注册时的免费使用次数 + free-trial-quota: 5