snatch speed

This commit is contained in:
xiaomlove
2021-05-17 00:44:35 +08:00
parent b2067c9424
commit d598c57891
+8 -4
View File
@@ -237,17 +237,21 @@ class TorrentRepository extends BaseRepository
public function getSnatchUploadSpeed($snatch) public function getSnatchUploadSpeed($snatch)
{ {
if ($snatch->seedtime <= 0) { if ($snatch->seedtime <= 0) {
return mksize(0); $speed = mksize(0);
} else {
$speed = mksize($snatch->uploaded / ($snatch->seedtime + $snatch->leechtime));
} }
return mksize($snatch->uploaded / ($snatch->seedtime + $snatch->leechtime)); return "$speed/s";
} }
public function getSnatchDownloadSpeed($snatch) public function getSnatchDownloadSpeed($snatch)
{ {
if ($snatch->leechtime <= 0) { if ($snatch->leechtime <= 0) {
return mksize(0); $speed = mksize(0);
} else {
$speed = mksize($snatch->downloaded / $snatch->leechtime);
} }
return mksize($snatch->downloaded / $snatch->leechtime); return "$speed/s";
} }
} }