feat: 增强二维码代理控制器,添加用户进度显示格式的系统配置读取功能

This commit is contained in:
yahaozhang
2025-09-15 15:10:21 +08:00
parent 161f0703c6
commit 40f02f4539
3 changed files with 22 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import com.gameplatform.server.model.dto.link.GameInterfaceResponse;
import com.gameplatform.server.model.entity.agent.LinkBatch;
import com.gameplatform.server.model.entity.agent.LinkTask;
import com.gameplatform.server.service.external.ScriptClient;
import com.gameplatform.server.service.admin.SystemConfigService;
import com.gameplatform.server.service.link.LinkStatusService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -39,17 +40,20 @@ public class QrProxyController {
private final String appBaseUrl;
private final LinkTaskMapper linkTaskMapper;
private final LinkBatchMapper linkBatchMapper;
private final SystemConfigService systemConfigService;
public QrProxyController(ScriptClient scriptClient,
LinkStatusService linkStatusService,
@Value("${app.base-url}") String appBaseUrl,
LinkTaskMapper linkTaskMapper,
LinkBatchMapper linkBatchMapper) {
LinkBatchMapper linkBatchMapper,
SystemConfigService systemConfigService) {
this.scriptClient = scriptClient;
this.linkStatusService = linkStatusService;
this.appBaseUrl = appBaseUrl;
this.linkTaskMapper = linkTaskMapper;
this.linkBatchMapper = linkBatchMapper;
this.systemConfigService = systemConfigService;
}
@GetMapping(value = "/image/{codeNo}/qr.png", produces = MediaType.IMAGE_PNG_VALUE)
@@ -268,6 +272,8 @@ public class QrProxyController {
response.setFirstRewardUrl(appBaseUrl + "/api/link/image/" + codeNo + "/first-reward.png");
response.setMidRewardUrl(appBaseUrl + "/api/link/image/" + codeNo + "/mid-reward.png");
response.setEndRewardUrl(appBaseUrl + "/api/link/image/" + codeNo + "/end-reward.png");
// 设置用户进度显示格式(从系统配置读取)
response.setProgressDisplayFormat(systemConfigService.getProgressDisplayFormat());
log.info("游戏界面数据构建完成: codeNo={}, totalPoints={}", codeNo, response.getTotalPoints());

View File

@@ -47,7 +47,16 @@ public class GameInterfaceResponse {
@Schema(description = "已经完成的点数")
private Integer completedPoints;
@Schema(description = "操作是否成功", example = "true")
@Schema(description = "用户端进度显示格式percent 或 ratio", example = "percent")
private String progressDisplayFormat;
public String getProgressDisplayFormat() {
return progressDisplayFormat;
}
public void setProgressDisplayFormat(String progressDisplayFormat) {
this.progressDisplayFormat = progressDisplayFormat;
}
public String getCodeNo() {
return codeNo;

View File

@@ -118,6 +118,11 @@ public class SystemConfigService {
return getConfigValueAsInt("link.first_region_expire", 600);
}
// 获取用户进度显示格式percent 或 ratio
public String getProgressDisplayFormat() {
return getConfigValue("user.progress_display_format", "percent");
}
// 批量更新配置
public boolean updateConfigs(List<SystemConfig> configs) {
if (configs == null || configs.isEmpty()) {