mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 20:17:24 +08:00
calculate seed bonus when specific torrent id do not join peers
This commit is contained in:
@@ -5588,14 +5588,15 @@ function calculate_seed_bonus($uid, $torrentIdArr = null): array
|
|||||||
$A = 0;
|
$A = 0;
|
||||||
$count = $torrent_peer_count = 0;
|
$count = $torrent_peer_count = 0;
|
||||||
$logPrefix = "[CALCULATE_SEED_BONUS], uid: $uid, torrentIdArr: " . json_encode($torrentIdArr);
|
$logPrefix = "[CALCULATE_SEED_BONUS], uid: $uid, torrentIdArr: " . json_encode($torrentIdArr);
|
||||||
$whereTorrent = '';
|
|
||||||
if ($torrentIdArr !== null) {
|
if ($torrentIdArr !== null) {
|
||||||
if (empty($torrentIdArr)) {
|
if (empty($torrentIdArr)) {
|
||||||
$torrentIdArr = [-1];
|
$torrentIdArr = [-1];
|
||||||
}
|
}
|
||||||
$whereTorrent = sprintf("and peers.torrent in (%s)", implode(',', $torrentIdArr));
|
$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)";
|
||||||
|
} 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 from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = $uid AND peers.seeder ='yes' $whereTorrent group by peers.torrent, peers.peer_id";
|
|
||||||
$torrentResult = \Nexus\Database\NexusDB::select($sql);
|
$torrentResult = \Nexus\Database\NexusDB::select($sql);
|
||||||
do_log("$logPrefix, sql: $sql, count: " . count($torrentResult));
|
do_log("$logPrefix, sql: $sql, count: " . count($torrentResult));
|
||||||
foreach ($torrentResult as $torrent)
|
foreach ($torrentResult as $torrent)
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ if($_SERVER['REQUEST_METHOD'] === 'POST'){
|
|||||||
<tr><td class="rowhead"><?php echo $lang_complains['text_new_email']?></td><td class="rowfollow" align="left"><input type="email" name="email" style="width: 180px; border: 1px solid gray" /></td></tr>
|
<tr><td class="rowhead"><?php echo $lang_complains['text_new_email']?></td><td class="rowfollow" align="left"><input type="email" name="email" style="width: 180px; border: 1px solid gray" /></td></tr>
|
||||||
<tr><td class="rowhead"><?php echo $lang_complains['text_new_body']?></td><td class="rowfollow" align="left"><textarea name="body" style="width: 200px; height: 250px" placeholder="<?= $lang_complains['text_new_body_placeholder'] ?>"></textarea></td></tr>
|
<tr><td class="rowhead"><?php echo $lang_complains['text_new_body']?></td><td class="rowfollow" align="left"><textarea name="body" style="width: 200px; height: 250px" placeholder="<?= $lang_complains['text_new_body_placeholder'] ?>"></textarea></td></tr>
|
||||||
<?php show_image_code (); ?>
|
<?php show_image_code (); ?>
|
||||||
<tr><td class="toolbox" colspan="2" align="right"><input type="submit" value="<?= $lang_complains['text_new_submit']?>" class="btn" /></td></tr>
|
<tr><td class="toolbox" colspan="2" align="center"><input type="submit" value="<?= $lang_complains['text_new_submit']?>" class="btn" /></td></tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
Reference in New Issue
Block a user