修改Tracker服务器相关bug
Change-Id: Id3ec61034575bd794724be98f832f8c065448b92
diff --git a/src/main/java/com/pt/entity/PeerInfoEntity.java b/src/main/java/com/pt/entity/PeerInfoEntity.java
index 56125cb..e2d89be 100644
--- a/src/main/java/com/pt/entity/PeerInfoEntity.java
+++ b/src/main/java/com/pt/entity/PeerInfoEntity.java
@@ -8,24 +8,26 @@
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
+ private long id;
+
+ private String peerId;
private String infoHash;
private String ip;
private int port;
- private String peerId;
+
private LocalDateTime lastSeen;
// 新增状态字段
private String status; // "seeding", "downloading", "completed"
- private boolean isActive; // 是否活跃
+ private int isActive; // 是否活跃
// 下载字段
- private long uploaded; // 已上传量
- private long downloaded; // 已下载量
- private long left; // 剩余下载量
+ private long upload; // 已上传量
+ private long download; // 已下载量 // 剩余下载量
- private String username; // 添加用户名字段
+ @Column(name = "download_left")
+ private long left;
public PeerInfoEntity(String ipAddress, int port, String peerId) {
this.ip = ipAddress;
@@ -33,21 +35,19 @@
this.peerId = peerId;
this.lastSeen = LocalDateTime.now();
this.status = "downloading"; // 默认状态为下载中
- this.isActive = true; // 默认活跃状态
- this.uploaded = 0;
- this.downloaded = 0;
- this.left = 0;
+ this.isActive = 1; // 默认活跃状态
+ this.upload = 0;
+ this.download = 0;
}
public PeerInfoEntity() {
}
- public Long getId() {
+ public long getId() {
return id;
}
-
- public void setId(Long id) {
+ public void setId(long id) {
this.id = id;
}
@@ -56,27 +56,19 @@
}
public long getUploaded() {
- return uploaded;
+ return upload;
}
public void setUploaded(long uploaded) {
- this.uploaded = uploaded;
+ this.upload = uploaded;
}
public long getDownloaded() {
- return downloaded;
+ return download;
}
public void setDownloaded(long downloaded) {
- this.downloaded = downloaded;
- }
-
- public long getLeft() {
- return left;
- }
-
- public void setLeft(long left) {
- this.left = left;
+ this.download = downloaded;
}
public void setInfoHash(String infoHash) {
@@ -124,19 +116,27 @@
this.status = status;
}
- public boolean isActive() {
+ public int isActive() {
return isActive;
}
- public void setActive(boolean active) {
+ public void setActive(int active) {
isActive = active;
}
- public String getUsername() {
- return username;
+ public void setIsActive(int isActive) {
+ this.isActive = isActive;
}
- public void setUsername(String username) {
- this.username = username;
+ public int getIsActive() {
+ return isActive;
+ }
+
+ public long getLeft() {
+ return left;
+ }
+
+ public void setLeft(long left) {
+ this.left = left;
}
}