feat: 增强二维码代理控制器,添加用户进度显示格式的系统配置读取功能
This commit is contained in:
@@ -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.LinkBatch;
|
||||||
import com.gameplatform.server.model.entity.agent.LinkTask;
|
import com.gameplatform.server.model.entity.agent.LinkTask;
|
||||||
import com.gameplatform.server.service.external.ScriptClient;
|
import com.gameplatform.server.service.external.ScriptClient;
|
||||||
|
import com.gameplatform.server.service.admin.SystemConfigService;
|
||||||
import com.gameplatform.server.service.link.LinkStatusService;
|
import com.gameplatform.server.service.link.LinkStatusService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -39,17 +40,20 @@ public class QrProxyController {
|
|||||||
private final String appBaseUrl;
|
private final String appBaseUrl;
|
||||||
private final LinkTaskMapper linkTaskMapper;
|
private final LinkTaskMapper linkTaskMapper;
|
||||||
private final LinkBatchMapper linkBatchMapper;
|
private final LinkBatchMapper linkBatchMapper;
|
||||||
|
private final SystemConfigService systemConfigService;
|
||||||
|
|
||||||
public QrProxyController(ScriptClient scriptClient,
|
public QrProxyController(ScriptClient scriptClient,
|
||||||
LinkStatusService linkStatusService,
|
LinkStatusService linkStatusService,
|
||||||
@Value("${app.base-url}") String appBaseUrl,
|
@Value("${app.base-url}") String appBaseUrl,
|
||||||
LinkTaskMapper linkTaskMapper,
|
LinkTaskMapper linkTaskMapper,
|
||||||
LinkBatchMapper linkBatchMapper) {
|
LinkBatchMapper linkBatchMapper,
|
||||||
|
SystemConfigService systemConfigService) {
|
||||||
this.scriptClient = scriptClient;
|
this.scriptClient = scriptClient;
|
||||||
this.linkStatusService = linkStatusService;
|
this.linkStatusService = linkStatusService;
|
||||||
this.appBaseUrl = appBaseUrl;
|
this.appBaseUrl = appBaseUrl;
|
||||||
this.linkTaskMapper = linkTaskMapper;
|
this.linkTaskMapper = linkTaskMapper;
|
||||||
this.linkBatchMapper = linkBatchMapper;
|
this.linkBatchMapper = linkBatchMapper;
|
||||||
|
this.systemConfigService = systemConfigService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/image/{codeNo}/qr.png", produces = MediaType.IMAGE_PNG_VALUE)
|
@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.setFirstRewardUrl(appBaseUrl + "/api/link/image/" + codeNo + "/first-reward.png");
|
||||||
response.setMidRewardUrl(appBaseUrl + "/api/link/image/" + codeNo + "/mid-reward.png");
|
response.setMidRewardUrl(appBaseUrl + "/api/link/image/" + codeNo + "/mid-reward.png");
|
||||||
response.setEndRewardUrl(appBaseUrl + "/api/link/image/" + codeNo + "/end-reward.png");
|
response.setEndRewardUrl(appBaseUrl + "/api/link/image/" + codeNo + "/end-reward.png");
|
||||||
|
// 设置用户进度显示格式(从系统配置读取)
|
||||||
|
response.setProgressDisplayFormat(systemConfigService.getProgressDisplayFormat());
|
||||||
|
|
||||||
log.info("游戏界面数据构建完成: codeNo={}, totalPoints={}", codeNo, response.getTotalPoints());
|
log.info("游戏界面数据构建完成: codeNo={}, totalPoints={}", codeNo, response.getTotalPoints());
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,16 @@ public class GameInterfaceResponse {
|
|||||||
@Schema(description = "已经完成的点数")
|
@Schema(description = "已经完成的点数")
|
||||||
private Integer completedPoints;
|
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() {
|
public String getCodeNo() {
|
||||||
return codeNo;
|
return codeNo;
|
||||||
|
|||||||
@@ -118,6 +118,11 @@ public class SystemConfigService {
|
|||||||
return getConfigValueAsInt("link.first_region_expire", 600);
|
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) {
|
public boolean updateConfigs(List<SystemConfig> configs) {
|
||||||
if (configs == null || configs.isEmpty()) {
|
if (configs == null || configs.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user