feat: 添加用户端链接状态查询接口及自动刷新逻辑
主要修改: 1. 在LinkController中新增获取用户链接状态的接口,支持通过linkId或codeNo查询。 2. 在LinkStatusService中实现用户链接状态查询逻辑,包含自动刷新和二维码更新功能。 3. 更新LinkTask实体,添加needRefresh、refreshTime、qrCreatedAt和qrExpireAt字段以支持新功能。 4. 在ScriptClient中新增检查空闲设备、选区、刷新、检查上号状态等操作的实现。 5. 更新SecurityConfig,允许用户端获取链接状态接口公开访问。 技术细节: - 新增UserLinkStatusResponse DTO以支持用户链接状态的返回格式。 - 通过脚本端接口实现链接状态的自动刷新和二维码信息更新。
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
package com.gameplatform.server.model.dto.link;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@Schema(description = "用户端链接状态响应")
|
||||
public class UserLinkStatusResponse {
|
||||
|
||||
@Schema(description = "链接状态", example = "NEW", allowableValues = {"NEW", "USING", "LOGGED_IN", "REFUNDED", "EXPIRED"})
|
||||
private String status;
|
||||
|
||||
@Schema(description = "是否需要刷新", example = "false")
|
||||
private Boolean needRefresh;
|
||||
|
||||
@Schema(description = "选择的区域", example = "Q", allowableValues = {"Q", "V"})
|
||||
private String region;
|
||||
|
||||
@Schema(description = "二维码信息")
|
||||
private QrInfo qr;
|
||||
|
||||
@Schema(description = "视图类型", example = "FIRST", allowableValues = {"FIRST", "SCAN", "SECOND"})
|
||||
private String view;
|
||||
|
||||
@Schema(description = "静态资源信息")
|
||||
private AssetsInfo assets;
|
||||
|
||||
@Schema(description = "二维码信息")
|
||||
public static class QrInfo {
|
||||
@Schema(description = "二维码URL", example = "http://36.138.184.60:12345/{编号}/二维码.png")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "创建时间戳", example = "1730000000000")
|
||||
private Long createdAt;
|
||||
|
||||
@Schema(description = "过期时间戳", example = "1730000060000")
|
||||
private Long expireAt;
|
||||
|
||||
public String getUrl() { return url; }
|
||||
public void setUrl(String url) { this.url = url; }
|
||||
|
||||
public Long getCreatedAt() { return createdAt; }
|
||||
public void setCreatedAt(Long createdAt) { this.createdAt = createdAt; }
|
||||
|
||||
public Long getExpireAt() { return expireAt; }
|
||||
public void setExpireAt(Long expireAt) { this.expireAt = expireAt; }
|
||||
}
|
||||
|
||||
@Schema(description = "静态资源信息")
|
||||
public static class AssetsInfo {
|
||||
@Schema(description = "基础URL", example = "http://36.138.184.60:12345/{编号}/")
|
||||
private String base;
|
||||
|
||||
@Schema(description = "首次主页图片", example = "首次主页.png")
|
||||
private String firstHome;
|
||||
|
||||
@Schema(description = "首次赏金图片", example = "首次赏金.png")
|
||||
private String firstBonus;
|
||||
|
||||
@Schema(description = "中途赏金图片", example = "中途赏金.png")
|
||||
private String midBonus;
|
||||
|
||||
@Schema(description = "结束赏金图片", example = "结束赏金.png")
|
||||
private String endBonus;
|
||||
|
||||
public String getBase() { return base; }
|
||||
public void setBase(String base) { this.base = base; }
|
||||
|
||||
public String getFirstHome() { return firstHome; }
|
||||
public void setFirstHome(String firstHome) { this.firstHome = firstHome; }
|
||||
|
||||
public String getFirstBonus() { return firstBonus; }
|
||||
public void setFirstBonus(String firstBonus) { this.firstBonus = firstBonus; }
|
||||
|
||||
public String getMidBonus() { return midBonus; }
|
||||
public void setMidBonus(String midBonus) { this.midBonus = midBonus; }
|
||||
|
||||
public String getEndBonus() { return endBonus; }
|
||||
public void setEndBonus(String endBonus) { this.endBonus = endBonus; }
|
||||
}
|
||||
|
||||
// Getters and Setters
|
||||
public String getStatus() { return status; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
|
||||
public Boolean getNeedRefresh() { return needRefresh; }
|
||||
public void setNeedRefresh(Boolean needRefresh) { this.needRefresh = needRefresh; }
|
||||
|
||||
public String getRegion() { return region; }
|
||||
public void setRegion(String region) { this.region = region; }
|
||||
|
||||
public QrInfo getQr() { return qr; }
|
||||
public void setQr(QrInfo qr) { this.qr = qr; }
|
||||
|
||||
public String getView() { return view; }
|
||||
public void setView(String view) { this.view = view; }
|
||||
|
||||
public AssetsInfo getAssets() { return assets; }
|
||||
public void setAssets(AssetsInfo assets) { this.assets = assets; }
|
||||
}
|
||||
@@ -46,6 +46,18 @@ public class LinkTask {
|
||||
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@TableField("need_refresh")
|
||||
private Boolean needRefresh;
|
||||
|
||||
@TableField("refresh_time")
|
||||
private LocalDateTime refreshTime;
|
||||
|
||||
@TableField("qr_created_at")
|
||||
private LocalDateTime qrCreatedAt;
|
||||
|
||||
@TableField("qr_expire_at")
|
||||
private LocalDateTime qrExpireAt;
|
||||
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long id) { this.id = id; }
|
||||
@@ -88,4 +100,16 @@ public class LinkTask {
|
||||
|
||||
public LocalDateTime getUpdatedAt() { return updatedAt; }
|
||||
public void setUpdatedAt(LocalDateTime updatedAt) { this.updatedAt = updatedAt; }
|
||||
|
||||
public Boolean getNeedRefresh() { return needRefresh; }
|
||||
public void setNeedRefresh(Boolean needRefresh) { this.needRefresh = needRefresh; }
|
||||
|
||||
public LocalDateTime getRefreshTime() { return refreshTime; }
|
||||
public void setRefreshTime(LocalDateTime refreshTime) { this.refreshTime = refreshTime; }
|
||||
|
||||
public LocalDateTime getQrCreatedAt() { return qrCreatedAt; }
|
||||
public void setQrCreatedAt(LocalDateTime qrCreatedAt) { this.qrCreatedAt = qrCreatedAt; }
|
||||
|
||||
public LocalDateTime getQrExpireAt() { return qrExpireAt; }
|
||||
public void setQrExpireAt(LocalDateTime qrExpireAt) { this.qrExpireAt = qrExpireAt; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user