新增系统配置表及默认配置,更新链接生成请求DTO以支持链接数量参数,重构链接生成服务逻辑,添加链接状态查询和有效性检查接口,优化日志记录。

This commit is contained in:
zyh
2025-08-26 10:33:26 +08:00
parent 7317866f98
commit 599ec0a36b
73 changed files with 1829 additions and 50 deletions

View File

@@ -0,0 +1,35 @@
package com.gameplatform.server.model.dto.admin;
import com.gameplatform.server.model.entity.admin.SystemConfig;
public class SystemConfigConverter {
public static SystemConfigResponse toResponse(SystemConfig entity) {
if (entity == null) return null;
SystemConfigResponse response = new SystemConfigResponse();
response.setId(entity.getId());
response.setConfigKey(entity.getConfigKey());
response.setConfigValue(entity.getConfigValue());
response.setConfigType(entity.getConfigType());
response.setDescription(entity.getDescription());
response.setIsSystem(entity.getIsSystem());
response.setCreatedAt(entity.getCreatedAt());
response.setUpdatedAt(entity.getUpdatedAt());
return response;
}
public static SystemConfig toEntity(SystemConfigRequest request) {
if (request == null) return null;
SystemConfig entity = new SystemConfig();
entity.setConfigKey(request.getConfigKey());
entity.setConfigValue(request.getConfigValue());
entity.setConfigType(request.getConfigType());
entity.setDescription(request.getDescription());
entity.setIsSystem(request.getIsSystem());
return entity;
}
}

View File

@@ -0,0 +1,24 @@
package com.gameplatform.server.model.dto.admin;
public class SystemConfigRequest {
private String configKey;
private String configValue;
private String configType;
private String description;
private Boolean isSystem;
public String getConfigKey() { return configKey; }
public void setConfigKey(String configKey) { this.configKey = configKey; }
public String getConfigValue() { return configValue; }
public void setConfigValue(String configValue) { this.configValue = configValue; }
public String getConfigType() { return configType; }
public void setConfigType(String configType) { this.configType = configType; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public Boolean getIsSystem() { return isSystem; }
public void setIsSystem(Boolean isSystem) { this.isSystem = isSystem; }
}

View File

@@ -0,0 +1,38 @@
package com.gameplatform.server.model.dto.admin;
import java.time.LocalDateTime;
public class SystemConfigResponse {
private Long id;
private String configKey;
private String configValue;
private String configType;
private String description;
private Boolean isSystem;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public String getConfigKey() { return configKey; }
public void setConfigKey(String configKey) { this.configKey = configKey; }
public String getConfigValue() { return configValue; }
public void setConfigValue(String configValue) { this.configValue = configValue; }
public String getConfigType() { return configType; }
public void setConfigType(String configType) { this.configType = configType; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public Boolean getIsSystem() { return isSystem; }
public void setIsSystem(Boolean isSystem) { this.isSystem = isSystem; }
public LocalDateTime getCreatedAt() { return createdAt; }
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
public LocalDateTime getUpdatedAt() { return updatedAt; }
public void setUpdatedAt(LocalDateTime updatedAt) { this.updatedAt = updatedAt; }
}

View File

@@ -5,13 +5,13 @@ import io.swagger.v3.oas.annotations.media.Schema;
public class LinkGenerateRequest {
@Schema(description = "本次打脚本的次数", example = "10")
private Integer times;
@Schema(description = "每次打的数量", example = "5")
private Integer perTimeQuantity;
@Schema(description = "生成多少个链接", example = "5")
private Integer linkCount = 1; // 默认值为1
public Integer getTimes() { return times; }
public void setTimes(Integer times) { this.times = times; }
public Integer getPerTimeQuantity() { return perTimeQuantity; }
public void setPerTimeQuantity(Integer perTimeQuantity) { this.perTimeQuantity = perTimeQuantity; }
public Integer getLinkCount() { return linkCount; }
public void setLinkCount(Integer linkCount) { this.linkCount = linkCount; }
}

View File

@@ -0,0 +1,101 @@
package com.gameplatform.server.model.dto.link;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
@Schema(description = "链接状态响应")
public class LinkStatusResponse {
@Schema(description = "链接编号", example = "ABC12345")
private String codeNo;
@Schema(description = "批次ID", example = "123")
private Long batchId;
@Schema(description = "链接状态", example = "NEW", allowableValues = {"NEW", "USING", "LOGGED_IN", "REFUNDED", "EXPIRED"})
private String status;
@Schema(description = "链接状态描述", example = "新建")
private String statusDesc;
@Schema(description = "过期时间", example = "2024-01-15T16:30:00")
private LocalDateTime expireAt;
@Schema(description = "是否已过期", example = "false")
private Boolean isExpired;
@Schema(description = "剩余有效时间(秒)", example = "3600")
private Long remainingSeconds;
@Schema(description = "每次副本奖励点数", example = "50")
private Integer quantity;
@Schema(description = "打副本次数", example = "10")
private Integer times;
@Schema(description = "总奖励点数", example = "500")
private Integer totalPoints;
@Schema(description = "区域", example = "Q", allowableValues = {"Q", "V"})
private String region;
@Schema(description = "机器ID", example = "MACHINE001")
private String machineId;
@Schema(description = "登录时间", example = "2024-01-15T14:30:00")
private LocalDateTime loginAt;
@Schema(description = "创建时间", example = "2024-01-15T12:00:00")
private LocalDateTime createdAt;
@Schema(description = "更新时间", example = "2024-01-15T14:30:00")
private LocalDateTime updatedAt;
// Getters and Setters
public String getCodeNo() { return codeNo; }
public void setCodeNo(String codeNo) { this.codeNo = codeNo; }
public Long getBatchId() { return batchId; }
public void setBatchId(Long batchId) { this.batchId = batchId; }
public String getStatus() { return status; }
public void setStatus(String status) { this.status = status; }
public String getStatusDesc() { return statusDesc; }
public void setStatusDesc(String statusDesc) { this.statusDesc = statusDesc; }
public LocalDateTime getExpireAt() { return expireAt; }
public void setExpireAt(LocalDateTime expireAt) { this.expireAt = expireAt; }
public Boolean getIsExpired() { return isExpired; }
public void setIsExpired(Boolean isExpired) { this.isExpired = isExpired; }
public Long getRemainingSeconds() { return remainingSeconds; }
public void setRemainingSeconds(Long remainingSeconds) { this.remainingSeconds = remainingSeconds; }
public Integer getQuantity() { return quantity; }
public void setQuantity(Integer quantity) { this.quantity = quantity; }
public Integer getTimes() { return times; }
public void setTimes(Integer times) { this.times = times; }
public Integer getTotalPoints() { return totalPoints; }
public void setTotalPoints(Integer totalPoints) { this.totalPoints = totalPoints; }
public String getRegion() { return region; }
public void setRegion(String region) { this.region = region; }
public String getMachineId() { return machineId; }
public void setMachineId(String machineId) { this.machineId = machineId; }
public LocalDateTime getLoginAt() { return loginAt; }
public void setLoginAt(LocalDateTime loginAt) { this.loginAt = loginAt; }
public LocalDateTime getCreatedAt() { return createdAt; }
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
public LocalDateTime getUpdatedAt() { return updatedAt; }
public void setUpdatedAt(LocalDateTime updatedAt) { this.updatedAt = updatedAt; }
}

View File

@@ -0,0 +1,38 @@
package com.gameplatform.server.model.entity.admin;
import java.time.LocalDateTime;
public class SystemConfig {
private Long id;
private String configKey;
private String configValue;
private String configType;
private String description;
private Boolean isSystem;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public String getConfigKey() { return configKey; }
public void setConfigKey(String configKey) { this.configKey = configKey; }
public String getConfigValue() { return configValue; }
public void setConfigValue(String configValue) { this.configValue = configValue; }
public String getConfigType() { return configType; }
public void setConfigType(String configType) { this.configType = configType; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public Boolean getIsSystem() { return isSystem; }
public void setIsSystem(Boolean isSystem) { this.isSystem = isSystem; }
public LocalDateTime getCreatedAt() { return createdAt; }
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
public LocalDateTime getUpdatedAt() { return updatedAt; }
public void setUpdatedAt(LocalDateTime updatedAt) { this.updatedAt = updatedAt; }
}

View File

@@ -7,8 +7,6 @@ public class LinkBatch {
private Long agentId;
private Integer quantity;
private Integer times;
private Integer batchSize;
private Long deductPoints;
private Long operatorId;
private LocalDateTime createdAt;
@@ -24,12 +22,6 @@ public class LinkBatch {
public Integer getTimes() { return times; }
public void setTimes(Integer times) { this.times = times; }
public Integer getBatchSize() { return batchSize; }
public void setBatchSize(Integer batchSize) { this.batchSize = batchSize; }
public Long getDeductPoints() { return deductPoints; }
public void setDeductPoints(Long deductPoints) { this.deductPoints = deductPoints; }
public Long getOperatorId() { return operatorId; }
public void setOperatorId(Long operatorId) { this.operatorId = operatorId; }