增加了种子统计的内容
Change-Id: I139c8cf149c05465d1170baa4c143210bd71c888
diff --git a/src/main/java/com/pt/entity/PeerInfoEntity.java b/src/main/java/com/pt/entity/PeerInfoEntity.java
index 081df7f..c19a269 100644
--- a/src/main/java/com/pt/entity/PeerInfoEntity.java
+++ b/src/main/java/com/pt/entity/PeerInfoEntity.java
@@ -16,6 +16,15 @@
private String peerId;
private LocalDateTime lastSeen;
+ // 新增状态字段
+ private String status; // "seeding", "downloading", "completed"
+ private boolean isActive; // 是否活跃
+
+ // 下载字段
+ private long uploaded; // 已上传量
+ private long downloaded; // 已下载量
+ private long left; // 剩余下载量
+
public Long getId() {
return id;
}
@@ -28,6 +37,30 @@
return infoHash;
}
+ public long getUploaded() {
+ return uploaded;
+ }
+
+ public void setUploaded(long uploaded) {
+ this.uploaded = uploaded;
+ }
+
+ public long getDownloaded() {
+ return downloaded;
+ }
+
+ public void setDownloaded(long downloaded) {
+ this.downloaded = downloaded;
+ }
+
+ public long getLeft() {
+ return left;
+ }
+
+ public void setLeft(long left) {
+ this.left = left;
+ }
+
public void setInfoHash(String infoHash) {
this.infoHash = infoHash;
}
@@ -63,4 +96,21 @@
public void setPeerId(String peerId) {
this.peerId = peerId;
}
+
+ // 新增状态字段的getter与setter
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public boolean isActive() {
+ return isActive;
+ }
+
+ public void setActive(boolean active) {
+ isActive = active;
+ }
}
diff --git a/src/main/java/com/pt/entity/TorrentStats.java b/src/main/java/com/pt/entity/TorrentStats.java
new file mode 100644
index 0000000..0c04142
--- /dev/null
+++ b/src/main/java/com/pt/entity/TorrentStats.java
@@ -0,0 +1,71 @@
+package com.pt.entity;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+
+import java.time.LocalDateTime;
+
+@Entity
+public class TorrentStats {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Long id;
+
+ private Long torrentId; // 关联的种子ID
+ private int seederCount; // 当前做种人数
+ private int leecherCount; // 当前下载人数
+ private int completedCount; // 历史完成下载次数
+ private LocalDateTime lastUpdated;
+
+ // Getters and Setters
+
+ public int getSeederCount() {
+ return seederCount;
+ }
+
+ public void setSeederCount(int seederCount) {
+ this.seederCount = seederCount;
+ }
+
+ public int getLeecherCount() {
+ return leecherCount;
+ }
+
+ public void setLeecherCount(int leecherCount) {
+ this.leecherCount = leecherCount;
+ }
+
+ public int getCompletedCount() {
+ return completedCount;
+ }
+
+ public void setCompletedCount(int completedCount) {
+ this.completedCount = completedCount;
+ }
+
+ public LocalDateTime getLastUpdated() {
+ return lastUpdated;
+ }
+
+ public void setLastUpdated(LocalDateTime lastUpdated) {
+ this.lastUpdated = lastUpdated;
+ }
+
+ public Long getTorrentId() {
+ return torrentId;
+ }
+
+ public void setTorrentId(Long torrentId) {
+ this.torrentId = torrentId;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+}