feat: 在链接生成请求中更新描述,添加链接倍数配置获取方法,并在链接生成服务中应用倍数计算,优化积分需求逻辑

This commit is contained in:
zyh
2025-10-09 09:47:15 +08:00
parent 5321530202
commit 96e95cbb90
5 changed files with 14 additions and 5 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -3,7 +3,7 @@ package com.gameplatform.server.model.dto.link;
import io.swagger.v3.oas.annotations.media.Schema;
public class LinkGenerateRequest {
@Schema(description = "本次打脚本的次数", example = "10")
@Schema(description = "本次打脚本的次数实际使用times*link.scaled作为真实次数", example = "10")
private Integer times;
@Schema(description = "生成多少个链接", example = "5")
private Integer linkCount = 1; // 默认值为1

View File

@@ -152,6 +152,11 @@ public class SystemConfigService {
return getConfigValueAsInt("link.qr_expire_time", 600);
}
// 获取链接倍数配置
public Integer getLinkScaled() {
return getConfigValueAsInt("link.scaled", 1);
}

View File

@@ -71,12 +71,16 @@ public class LinkGenerationService {
// 从配置表获取每次副本的奖励点数
int perTimeQuantity = systemConfigService.getDefaultQuantity();
long needPoints = (long) times; // 只扣times不乘以perTimeQuantity
// 获取链接倍数配置
int linkScaled = systemConfigService.getLinkScaled();
// 计算真实的times = times * link.scaled
int realTimes = times * linkScaled;
long needPoints = (long) realTimes; // 使用真实的times计算需要的积分
// 移除expireHours配置因为NEW状态不设置过期时间
if (log.isDebugEnabled()) {
log.debug("generateLinks operatorId={} operatorType={} times={} linkCount={} perTimeQuantity={} needPoints={}",
operatorId, operatorType, times, linkCount, perTimeQuantity, needPoints);
log.debug("generateLinks operatorId={} operatorType={} times={} linkScaled={} realTimes={} linkCount={} perTimeQuantity={} needPoints={}",
operatorId, operatorType, times, linkScaled, realTimes, linkCount, perTimeQuantity, needPoints);
}
if (!isAdminOperator) {
@@ -90,7 +94,7 @@ public class LinkGenerationService {
LinkBatch batch = new LinkBatch();
batch.setAgentId(operator.getId());
batch.setQuantity(perTimeQuantity); // 每次副本的奖励点数
batch.setTimes(times); // 打副本的次数
batch.setTimes(realTimes); // 打副本的次数(应用倍数后的真实次数)
batch.setOperatorId(operatorId);
linkBatchMapper.insert(batch);