增加用户详细页面种子列表显示当前发布做种下载的总大小 (#18)

* 增加用户详细页种子列表显示相关信息

* 增加用户详细页面种子列表显示当前发布做种下载的总大小

Co-authored-by: xiaomlove <353856593@qq.com>
This commit is contained in:
rabbitwit
2021-06-21 09:55:20 +08:00
committed by GitHub
parent d2a8f1a1a6
commit 5a8f65b4e5
2 changed files with 26 additions and 10 deletions

View File

@@ -14,7 +14,8 @@ $lang_getusertorrentlistajax = array
'col_time_completed' => "完成时间", 'col_time_completed' => "完成时间",
'col_se_time' => "做种时间", 'col_se_time' => "做种时间",
'col_le_time' => "下载时间", 'col_le_time' => "下载时间",
'text_record' => "条记录", 'text_record' => " 条记录",
'text_no_record' => "没有记录", 'text_no_record' => "没有记录",
'text_total_size' => " | 总大小:",
); );
?> ?>

View File

@@ -24,6 +24,7 @@ function maketable($res, $mode = 'seeding')
$showletime = false; $showletime = false;
$showcotime = false; $showcotime = false;
$showanonymous = true; $showanonymous = true;
$showtotalsize = true;
$columncount = 8; $columncount = 8;
break; break;
} }
@@ -38,6 +39,7 @@ function maketable($res, $mode = 'seeding')
$showletime = false; $showletime = false;
$showcotime = false; $showcotime = false;
$showanonymous = false; $showanonymous = false;
$showtotalsize = true;
$columncount = 8; $columncount = 8;
break; break;
} }
@@ -52,6 +54,7 @@ function maketable($res, $mode = 'seeding')
$showletime = false; $showletime = false;
$showcotime = false; $showcotime = false;
$showanonymous = false; $showanonymous = false;
$showtotalsize = true;
$columncount = 8; $columncount = 8;
break; break;
} }
@@ -66,6 +69,7 @@ function maketable($res, $mode = 'seeding')
$showletime = true; $showletime = true;
$showcotime = true; $showcotime = true;
$showanonymous = false; $showanonymous = false;
$showtotalsize = false;
$columncount = 8; $columncount = 8;
break; break;
} }
@@ -80,6 +84,7 @@ function maketable($res, $mode = 'seeding')
$showletime = true; $showletime = true;
$showcotime = false; $showcotime = false;
$showanonymous = false; $showanonymous = false;
$showtotalsize = false;
$columncount = 7; $columncount = 7;
break; break;
} }
@@ -94,6 +99,13 @@ function maketable($res, $mode = 'seeding')
$sphighlight = get_torrent_bg_color($arr['sp_state']); $sphighlight = get_torrent_bg_color($arr['sp_state']);
$sp_torrent = get_torrent_promotion_append($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); $hrImg = get_hr_img($arr);
//torrent name //torrent name
@@ -177,7 +189,7 @@ switch ($type)
$count = mysql_num_rows($res); $count = mysql_num_rows($res);
if ($count > 0) if ($count > 0)
{ {
$torrentlist = maketable($res, 'uploaded'); list($torrentlist, $total_size) = maketable ( $res, 'uploaded' );
} }
break; 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(); $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); $count = mysql_num_rows($res);
if ($count > 0){ if ($count > 0){
$torrentlist = maketable($res, 'seeding'); list($torrentlist, $total_size) = maketable ( $res, 'seeding' );
} }
break; 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(); $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); $count = mysql_num_rows($res);
if ($count > 0){ if ($count > 0){
$torrentlist = maketable($res, 'leeching'); list($torrentlist, $total_size) = maketable ( $res, 'leeching' );
} }
break; break;
} }
@@ -211,7 +223,7 @@ switch ($type)
$count = mysql_num_rows($res); $count = mysql_num_rows($res);
if ($count > 0) if ($count > 0)
{ {
$torrentlist = maketable($res, 'completed'); list($torrentlist, $total_size) = maketable ( $res, 'completed' );
} }
break; break;
} }
@@ -223,7 +235,7 @@ switch ($type)
$count = mysql_num_rows($res); $count = mysql_num_rows($res);
if ($count > 0) if ($count > 0)
{ {
$torrentlist = maketable($res, 'incomplete'); list($torrentlist, $total_size) = maketable ( $res, 'incomplete' );
} }
break; break;
} }
@@ -235,8 +247,11 @@ switch ($type)
} }
} }
if ($count) if ($total_size){
echo "<b>".$count."</b>".$lang_getusertorrentlistajax['text_record'].add_s($count)."<br />".$torrentlist; echo "<br /><b>" . $count . "</b>" . $lang_getusertorrentlistajax ['text_record'] . add_s ( $count ) . $lang_getusertorrentlistajax['text_total_size'] . mksize($total_size) . "<br /><br />" . $torrentlist;
else }elseif ($count){
echo $lang_getusertorrentlistajax['text_no_record']; echo "<br /><b>".$count."</b>".$lang_getusertorrentlistajax['text_record'].add_s($count)."<br /><br />".$torrentlist;
}else{
echo $lang_getusertorrentlistajax['text_no_record'];
}
?> ?>