mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
invite add seed bonus
This commit is contained in:
@@ -5957,9 +5957,9 @@ function calculate_seed_bonus($uid, $torrentIdArr = null): array
|
||||
$torrentIdArr = [-1];
|
||||
}
|
||||
$idStr = implode(',', \Illuminate\Support\Arr::wrap($torrentIdArr));
|
||||
$sql = "select torrents.id, torrents.added, torrents.size, torrents.seeders, 'NO_PEER_ID' as peerID from torrents WHERE id in ($idStr)";
|
||||
$sql = "select torrents.id, torrents.added, torrents.size, torrents.seeders, 'NO_PEER_ID' as peerID, '' as last_action from torrents WHERE id in ($idStr)";
|
||||
} else {
|
||||
$sql = "select torrents.id, torrents.added, torrents.size, torrents.seeders, peers.id as peerID from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = $uid AND peers.seeder ='yes' group by peers.torrent, peers.peer_id";
|
||||
$sql = "select torrents.id, torrents.added, torrents.size, torrents.seeders, peers.id as peerID, peers.last_action from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = $uid AND peers.seeder ='yes' group by peers.torrent, peers.peer_id";
|
||||
}
|
||||
$tagGrouped = [];
|
||||
$torrentResult = \Nexus\Database\NexusDB::select($sql);
|
||||
@@ -5975,8 +5975,12 @@ function calculate_seed_bonus($uid, $torrentIdArr = null): array
|
||||
$zeroBonusTag = \App\Models\Setting::get('bonus.zero_bonus_tag');
|
||||
$zeroBonusFactor = \App\Models\Setting::get('bonus.zero_bonus_factor');
|
||||
do_log("$logPrefix, sql: $sql, count: " . count($torrentResult) . ", officialTag: $officialTag, officialAdditionalFactor: $officialAdditionalFactor, zeroBonusTag: $zeroBonusTag, zeroBonusFactor: $zeroBonusFactor");
|
||||
$last_action = "";
|
||||
foreach ($torrentResult as $torrent)
|
||||
{
|
||||
if ($torrent['last_action'] > $last_action) {
|
||||
$last_action = $torrent['last_action'];
|
||||
}
|
||||
$size = bcadd($size, $torrent['size']);
|
||||
$weeks_alive = ($timenow - strtotime($torrent['added'])) / $sectoweek;
|
||||
$gb_size = $gb_size_raw = $torrent['size'] / 1073741824;
|
||||
@@ -6005,7 +6009,7 @@ function calculate_seed_bonus($uid, $torrentIdArr = null): array
|
||||
//Official addition don't think about the minimum value
|
||||
$official_bonus = $valuetwo * atan($official_a / $l_bonus);
|
||||
$result = compact(
|
||||
'seed_points','seed_bonus', 'A', 'count', 'torrent_peer_count', 'size',
|
||||
'seed_points','seed_bonus', 'A', 'count', 'torrent_peer_count', 'size', 'last_action',
|
||||
'official_bonus', 'official_a', 'official_torrent_peer_count', 'official_size'
|
||||
);
|
||||
$result['donor_times'] = $donortimes_bonus;
|
||||
|
||||
@@ -51,6 +51,12 @@ $lang_invite = array
|
||||
'harem_addition' => '后宫加成',
|
||||
'signup_link_help' => '右键复制',
|
||||
'signup_link' => '注册链接',
|
||||
'text_seed_torrent_count' => '当前做种数',
|
||||
'text_seed_torrent_size' => '当前做种体积',
|
||||
'text_seed_torrent_bonus_per_hour' => '当前纯做种时魔',
|
||||
'text_seed_torrent_bonus_per_hour_help' => '即做种积分,单纯做种的值,不考虑捐赠、官种、后宫等任何加成',
|
||||
'text_seed_torrent_last_announce_at' => '最后做种汇报时间',
|
||||
'text_enabled' => '启用',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -51,6 +51,12 @@ $lang_invite = array
|
||||
'harem_addition' => '後宮加成',
|
||||
'signup_link_help' => '右鍵復製',
|
||||
'signup_link' => '註冊鏈接',
|
||||
'text_seed_torrent_count' => '當前做種數',
|
||||
'text_seed_torrent_size' => '當前做種體積',
|
||||
'text_seed_torrent_bonus_per_hour' => '當前純做種時魔',
|
||||
'text_seed_torrent_bonus_per_hour_help' => '即做種積分,單純做種的值,不考慮捐贈、官種、後宮等任何加成',
|
||||
'text_seed_torrent_last_announce_at' => '最後做種匯報時間',
|
||||
'text_enabled' => '啟用',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -54,6 +54,12 @@ Best Regards,
|
||||
'harem_addition' => 'Harem addition',
|
||||
'signup_link_help' => 'Right click to copy',
|
||||
'signup_link' => 'Signup link',
|
||||
'text_seed_torrent_count' => 'Seeding counts',
|
||||
'text_seed_torrent_size' => 'Seeding size',
|
||||
'text_seed_torrent_bonus_per_hour' => 'Seeding bonus per hour',
|
||||
'text_seed_torrent_bonus_per_hour_help' => 'That is, seed points, do not consider donations, official torrent, harems and any other additions',
|
||||
'text_seed_torrent_last_announce_at' => 'Last announce time',
|
||||
'text_enabled' => 'Enabled',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -70,11 +70,61 @@ if ($type == 'new'){
|
||||
} else {
|
||||
inviteMenu($menuSelected);
|
||||
if ($menuSelected == 'invitee') {
|
||||
$rel = sql_query("SELECT COUNT(*) FROM users WHERE invited_by = ".mysql_real_escape_string($id)) or sqlerr(__FILE__, __LINE__);
|
||||
$whereStr = "invited_by = " . sqlesc($id);
|
||||
if (!empty($_GET['status'])) {
|
||||
$whereStr .= " and status = " . sqlesc($_GET['status']);
|
||||
}
|
||||
if (!empty($_GET['enabled'])) {
|
||||
$whereStr .= " and enabled = " . sqlesc($_GET['enabled']);
|
||||
}
|
||||
$rel = sql_query("SELECT COUNT(*) FROM users WHERE $whereStr") or sqlerr(__FILE__, __LINE__);
|
||||
$arro = mysql_fetch_row($rel);
|
||||
$number = $arro[0];
|
||||
|
||||
print("<table border=1 width=100% cellspacing=0 cellpadding=5>".
|
||||
$textSelectOnePlease = nexus_trans('nexus.select_one_please');
|
||||
$enabledOptions = $statusOptions = '';
|
||||
foreach (['yes', 'no'] as $item) {
|
||||
$enabledOptions .= sprintf(
|
||||
'<option value="%s"%s>%s</option>',
|
||||
$item, $_GET['enabled'] == $item ? ' selected' : '', strtoupper($item)
|
||||
);
|
||||
}
|
||||
foreach (['pending' => $lang_invite['text_pending'], 'confirmed' => $lang_invite['text_confirmed']] as $name => $text) {
|
||||
$statusOptions .= sprintf(
|
||||
'<option value="%s"%s>%s</option>',
|
||||
$name, $_GET['status'] == $name ? ' selected' : '', $text
|
||||
);
|
||||
}
|
||||
$resetText = nexus_trans('label.reset');
|
||||
$filterForm = <<<FORM
|
||||
<div>
|
||||
<form id="filterForm" action="{$_SERVER['REQUEST_URI']}" method="get">
|
||||
<input type="hidden" name="menu" value="{$menuSelected}" />
|
||||
<input type="hidden" name="id" value="{$id}" />
|
||||
<span>{$lang_invite['text_enabled']}:</span>
|
||||
<select name="enabled">
|
||||
<option value="">-{$textSelectOnePlease}-</option>
|
||||
{$enabledOptions}
|
||||
</select>
|
||||
|
||||
<span>{$lang_invite['text_status']}:</span>
|
||||
<select name="status">
|
||||
<option value="">-{$textSelectOnePlease}-</option>
|
||||
{$statusOptions}
|
||||
</select>
|
||||
|
||||
<input type="submit">
|
||||
<input type="button" id="reset" value="{$resetText}">
|
||||
</form>
|
||||
</div>
|
||||
FORM;
|
||||
$resetJs = <<<JS
|
||||
jQuery("#reset").on('click', function () {
|
||||
jQuery("select[name=status]").val('')
|
||||
jQuery("select[name=enabled]").val('')
|
||||
})
|
||||
JS;
|
||||
\Nexus\Nexus::js($resetJs, 'footer', false);
|
||||
print($filterForm."<table border=1 width=100% cellspacing=0 cellpadding=5>".
|
||||
"<form method=post action=takeconfirm.php?id=".htmlspecialchars($id).">");
|
||||
|
||||
if(!$number){
|
||||
@@ -82,13 +132,25 @@ if ($type == 'new'){
|
||||
} else {
|
||||
list($pagertop, $pagerbottom, $limit) = pager($pageSize, $number, "?id=$id&menu=$menuSelected&");
|
||||
$haremAdditionFactor = get_setting('bonus.harem_addition');
|
||||
$ret = sql_query("SELECT id, username, email, uploaded, downloaded, status, warned, enabled, donor, email FROM users WHERE invited_by = ".mysql_real_escape_string($id) . " $limit") or sqlerr();
|
||||
$ret = sql_query("SELECT id, username, email, uploaded, downloaded, status, warned, enabled, donor, email FROM users WHERE $whereStr $limit") or sqlerr();
|
||||
$num = mysql_num_rows($ret);
|
||||
|
||||
print("<tr><td class=colhead><b>".$lang_invite['text_username']."</b></td><td class=colhead><b>".$lang_invite['text_email']."</b></td><td class=colhead><b>".$lang_invite['text_uploaded']."</b></td><td class=colhead><b>".$lang_invite['text_downloaded']."</b></td><td class=colhead><b>".$lang_invite['text_ratio']."</b></td>");
|
||||
print("<tr>
|
||||
<td class=colhead><b>".$lang_invite['text_username']."</b></td>
|
||||
<td class=colhead><b>".$lang_invite['text_email']."</b></td>
|
||||
<td class=colhead><b>".$lang_invite['text_enabled']."</b></td>
|
||||
<td class=colhead><b>".$lang_invite['text_uploaded']."</b></td>
|
||||
<td class=colhead><b>".$lang_invite['text_downloaded']."</b></td>
|
||||
<td class=colhead><b>".$lang_invite['text_ratio']."</b></td>
|
||||
<td class=colhead><b>".$lang_invite['text_seed_torrent_count']."</b></td>
|
||||
<td class=colhead><b>".$lang_invite['text_seed_torrent_size']."</b></td>
|
||||
<td class=colhead title={$lang_invite['text_seed_torrent_bonus_per_hour_help']}><b>".$lang_invite['text_seed_torrent_bonus_per_hour']."</b></td>
|
||||
"
|
||||
);
|
||||
if ($haremAdditionFactor > 0) {
|
||||
print('<td class="colhead">'.$lang_invite['harem_addition'].'</td>');
|
||||
}
|
||||
print("<td class=colhead><b>".$lang_invite['text_seed_torrent_last_announce_at']."</b></td>");
|
||||
print("<td class=colhead><b>".$lang_invite['text_status']."</b></td>");
|
||||
if ($CURUSER['id'] == $id || get_user_class() >= UC_SYSOP) {
|
||||
print("<td class=colhead><b>".$lang_invite['text_confirm']."</b></td>");
|
||||
@@ -98,7 +160,6 @@ if ($type == 'new'){
|
||||
for ($i = 0; $i < $num; ++$i)
|
||||
{
|
||||
$arr = mysql_fetch_assoc($ret);
|
||||
$user = "<td class=rowfollow>" . get_username($arr['id']) . "</td>";
|
||||
|
||||
if ($arr["downloaded"] > 0) {
|
||||
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
|
||||
@@ -115,11 +176,23 @@ if ($type == 'new'){
|
||||
$status = "<a href=userdetails.php?id={$arr['id']}><font color=#1f7309>".$lang_invite['text_confirmed']."</font></a>";
|
||||
else
|
||||
$status = "<a href=checkuser.php?id={$arr['id']}><font color=#ca0226>".$lang_invite['text_pending']."</font></a>";
|
||||
$seedBonusResult = calculate_seed_bonus($arr['id']);
|
||||
print("<tr class=rowfollow>
|
||||
<td class=rowfollow>".get_username($arr['id'])."</td>
|
||||
<td>{$arr['email']}</td>
|
||||
<td class=rowfollow>".$arr['enabled']."</td>
|
||||
<td class=rowfollow>" . mksize($arr['uploaded']) . "</td>
|
||||
<td class=rowfollow>" . mksize($arr['downloaded']) . "</td>
|
||||
<td class=rowfollow>$ratio</td>
|
||||
<td class=rowfollow>{$seedBonusResult['count']}</td>
|
||||
<td class=rowfollow>".mksize($seedBonusResult['size'])."</td>
|
||||
<td class=rowfollow>".number_format($seedBonusResult['seed_points'], 3)."</td>
|
||||
");
|
||||
|
||||
print("<tr class=rowfollow>$user<td>{$arr['email']}</td><td class=rowfollow>" . mksize($arr['uploaded']) . "</td><td class=rowfollow>" . mksize($arr['downloaded']) . "</td><td class=rowfollow>$ratio</td>");
|
||||
if ($haremAdditionFactor > 0) {
|
||||
print ("<td class=rowfollow>".number_format(calculate_seed_bonus($arr['id'])['all_bonus'] * $haremAdditionFactor, 3)."</td>");
|
||||
print ("<td class=rowfollow>".number_format($seedBonusResult['seed_points'] * $haremAdditionFactor, 3)."</td>");
|
||||
}
|
||||
print("<td class=rowfollow>{$seedBonusResult['last_action']}</td>");
|
||||
print("<td class=rowfollow>$status</td>");
|
||||
if ($CURUSER['id'] == $id || get_user_class() >= UC_SYSOP){
|
||||
print("<td>");
|
||||
|
||||
@@ -8,4 +8,6 @@ return [
|
||||
'time_units' => [
|
||||
'week' => 'weeks',
|
||||
],
|
||||
'select_all' => 'Select all',
|
||||
'unselect_all' => 'Unselect all',
|
||||
];
|
||||
|
||||
@@ -8,4 +8,6 @@ return [
|
||||
'time_units' => [
|
||||
'week' => '周',
|
||||
],
|
||||
'select_all' => '全選',
|
||||
'unselect_all' => '全不選',
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user