From 5a8f65b4e5347dd649a93506b44ec781fda11e8a Mon Sep 17 00:00:00 2001
From: rabbitwit <71050783+rabbitwit@users.noreply.github.com>
Date: Mon, 21 Jun 2021 09:55:20 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7=E8=AF=A6?=
=?UTF-8?q?=E7=BB=86=E9=A1=B5=E9=9D=A2=E7=A7=8D=E5=AD=90=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8D=E5=8F=91=E5=B8=83=E5=81=9A?=
=?UTF-8?q?=E7=A7=8D=E4=B8=8B=E8=BD=BD=E7=9A=84=E6=80=BB=E5=A4=A7=E5=B0=8F?=
=?UTF-8?q?=20(#18)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* 增加用户详细页种子列表显示相关信息
* 增加用户详细页面种子列表显示当前发布做种下载的总大小
Co-authored-by: xiaomlove <353856593@qq.com>
---
lang/chs/lang_getusertorrentlistajax.php | 3 ++-
public/getusertorrentlistajax.php | 33 +++++++++++++++++-------
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/lang/chs/lang_getusertorrentlistajax.php b/lang/chs/lang_getusertorrentlistajax.php
index a3f999c1..2e5186ef 100644
--- a/lang/chs/lang_getusertorrentlistajax.php
+++ b/lang/chs/lang_getusertorrentlistajax.php
@@ -14,7 +14,8 @@ $lang_getusertorrentlistajax = array
'col_time_completed' => "完成时间",
'col_se_time' => "做种时间",
'col_le_time' => "下载时间",
- 'text_record' => "条记录",
+ 'text_record' => " 条记录",
'text_no_record' => "没有记录",
+ 'text_total_size' => " | 总大小:",
);
?>
diff --git a/public/getusertorrentlistajax.php b/public/getusertorrentlistajax.php
index 1ac95437..7b24f090 100644
--- a/public/getusertorrentlistajax.php
+++ b/public/getusertorrentlistajax.php
@@ -24,6 +24,7 @@ function maketable($res, $mode = 'seeding')
$showletime = false;
$showcotime = false;
$showanonymous = true;
+ $showtotalsize = true;
$columncount = 8;
break;
}
@@ -38,6 +39,7 @@ function maketable($res, $mode = 'seeding')
$showletime = false;
$showcotime = false;
$showanonymous = false;
+ $showtotalsize = true;
$columncount = 8;
break;
}
@@ -52,6 +54,7 @@ function maketable($res, $mode = 'seeding')
$showletime = false;
$showcotime = false;
$showanonymous = false;
+ $showtotalsize = true;
$columncount = 8;
break;
}
@@ -66,6 +69,7 @@ function maketable($res, $mode = 'seeding')
$showletime = true;
$showcotime = true;
$showanonymous = false;
+ $showtotalsize = false;
$columncount = 8;
break;
}
@@ -80,6 +84,7 @@ function maketable($res, $mode = 'seeding')
$showletime = true;
$showcotime = false;
$showanonymous = false;
+ $showtotalsize = false;
$columncount = 7;
break;
}
@@ -94,6 +99,13 @@ function maketable($res, $mode = 'seeding')
$sphighlight = get_torrent_bg_color($arr['sp_state']);
$sp_torrent = get_torrent_promotion_append($arr['sp_state']);
+ //Total size
+ if ($showtotalsize){
+ $total_size += $arr['size'];
+ }else{
+ $total_size = 0;
+ }
+
$hrImg = get_hr_img($arr);
//torrent name
@@ -177,7 +189,7 @@ switch ($type)
$count = mysql_num_rows($res);
if ($count > 0)
{
- $torrentlist = maketable($res, 'uploaded');
+ list($torrentlist, $total_size) = maketable ( $res, 'uploaded' );
}
break;
}
@@ -188,7 +200,7 @@ switch ($type)
$res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.added DESC") or sqlerr();
$count = mysql_num_rows($res);
if ($count > 0){
- $torrentlist = maketable($res, 'seeding');
+ list($torrentlist, $total_size) = maketable ( $res, 'seeding' );
}
break;
}
@@ -199,7 +211,7 @@ switch ($type)
$res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.added DESC") or sqlerr();
$count = mysql_num_rows($res);
if ($count > 0){
- $torrentlist = maketable($res, 'leeching');
+ list($torrentlist, $total_size) = maketable ( $res, 'leeching' );
}
break;
}
@@ -211,7 +223,7 @@ switch ($type)
$count = mysql_num_rows($res);
if ($count > 0)
{
- $torrentlist = maketable($res, 'completed');
+ list($torrentlist, $total_size) = maketable ( $res, 'completed' );
}
break;
}
@@ -223,7 +235,7 @@ switch ($type)
$count = mysql_num_rows($res);
if ($count > 0)
{
- $torrentlist = maketable($res, 'incomplete');
+ list($torrentlist, $total_size) = maketable ( $res, 'incomplete' );
}
break;
}
@@ -235,8 +247,11 @@ switch ($type)
}
}
-if ($count)
-echo "".$count."".$lang_getusertorrentlistajax['text_record'].add_s($count)."
".$torrentlist;
-else
-echo $lang_getusertorrentlistajax['text_no_record'];
+if ($total_size){
+ echo "
" . $count . "" . $lang_getusertorrentlistajax ['text_record'] . add_s ( $count ) . $lang_getusertorrentlistajax['text_total_size'] . mksize($total_size) . "
" . $torrentlist;
+ }elseif ($count){
+ echo "
".$count."".$lang_getusertorrentlistajax['text_record'].add_s($count)."
".$torrentlist;
+ }else{
+ echo $lang_getusertorrentlistajax['text_no_record'];
+}
?>