mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
up
This commit is contained in:
@@ -40,10 +40,12 @@ use App\Repositories\UserRepository;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use GeoIp2\Database\Reader;
|
use GeoIp2\Database\Reader;
|
||||||
|
use GuzzleHttp\Client;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Encryption\Encrypter;
|
use Illuminate\Encryption\Encrypter;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Support\Facades\Redis;
|
use Illuminate\Support\Facades\Redis;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
@@ -98,7 +100,17 @@ class Test extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
CleanupRepository::checkQueueFailedJobs();
|
$url = "http://127.0.0.1:7777/list-seeder-leecher-count";
|
||||||
|
$idArr = [8, 12];
|
||||||
|
$client = new Client();
|
||||||
|
$response = $client->post($url, ['json' => ['torrent_ids' => $idArr]]);
|
||||||
|
$result = json_decode((string)$response->getBody(), true);
|
||||||
|
dump($result);
|
||||||
|
if (!isset($result['ret']) || $result['ret'] != 0) {
|
||||||
|
echo "Bad";
|
||||||
|
} else {
|
||||||
|
echo "OK";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ class LoadTorrentBoughtUsers implements ShouldQueue
|
|||||||
|
|
||||||
private int $torrentId;
|
private int $torrentId;
|
||||||
|
|
||||||
|
public $tries = 1;
|
||||||
|
|
||||||
|
public $timeout = 1800;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new job instance.
|
* Create a new job instance.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.14');
|
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.14');
|
||||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2024-10-04');
|
defined('RELEASE_DATE') || define('RELEASE_DATE', '2024-10-07');
|
||||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
namespace Nexus\Plugin;
|
namespace Nexus\Plugin;
|
||||||
|
|
||||||
use App\Repositories\BaseRepository;
|
use App\Repositories\BaseRepository;
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
use Nexus\Database\NexusDB;
|
|
||||||
|
|
||||||
abstract class BasePlugin extends BaseRepository
|
abstract class BasePlugin extends BaseRepository
|
||||||
{
|
{
|
||||||
@@ -44,4 +42,14 @@ abstract class BasePlugin extends BaseRepository
|
|||||||
$pluginRoot = dirname($reflection->getFileName(), 2);
|
$pluginRoot = dirname($reflection->getFileName(), 2);
|
||||||
return $pluginRoot . "/resources/views/" . trim($name, "/");
|
return $pluginRoot . "/resources/views/" . trim($name, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function trans($name): string
|
||||||
|
{
|
||||||
|
return nexus_trans(sprintf("%s::%s", static::ID, $name));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getInstance(): static
|
||||||
|
{
|
||||||
|
return Plugin::getById(static::ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-10
@@ -168,16 +168,24 @@ function dltable($name, $arr, $torrent, &$isSeedBoxCaseWhens)
|
|||||||
$s .= "</table>\n";
|
$s .= "</table>\n";
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
$downloaders = array();
|
$downloaders = array();
|
||||||
$seeders = array();
|
$seeders = array();
|
||||||
$torrent = \App\Models\Torrent::query()->findOrFail($id, ['id', 'seeders', 'leechers']);
|
$torrent = \App\Models\Torrent::query()->findOrFail($id, ['id', 'seeders', 'leechers']);
|
||||||
$subres = sql_query("SELECT id, seeder, finishedat, downloadoffset, uploadoffset, ip, ipv4, ipv6, port, uploaded, downloaded, to_go, UNIX_TIMESTAMP(started) AS st, connectable, agent, peer_id, UNIX_TIMESTAMP(last_action) AS la, userid FROM peers WHERE torrent = $id") or sqlerr();
|
$seedersAndLeechers = apply_filter("torrent_seeder_leecher_list", [], $id);
|
||||||
while ($subrow = mysql_fetch_array($subres)) {
|
if (isset($seedersAndLeechers['seeders'], $seedersAndLeechers['leechers'])) {
|
||||||
if ($subrow["seeder"] == "yes")
|
// dd($seedersAndLeechers);
|
||||||
$seeders[] = $subrow;
|
$seeders = $seedersAndLeechers['seeders'];
|
||||||
else
|
$downloaders = $seedersAndLeechers['leechers'];
|
||||||
$downloaders[] = $subrow;
|
do_log("SEEDER_LEECHER_FROM_FILTER: torrent_seeder_leecher_list");
|
||||||
}
|
} else {
|
||||||
|
$subres = sql_query("SELECT id, seeder, finishedat, downloadoffset, uploadoffset, ip, ipv4, ipv6, port, uploaded, downloaded, to_go, UNIX_TIMESTAMP(started) AS st, connectable, agent, peer_id, UNIX_TIMESTAMP(last_action) AS la, userid FROM peers WHERE torrent = $id") or sqlerr();
|
||||||
|
while ($subrow = mysql_fetch_array($subres)) {
|
||||||
|
if ($subrow["seeder"] == "yes")
|
||||||
|
$seeders[] = $subrow;
|
||||||
|
else
|
||||||
|
$downloaders[] = $subrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
$seedersCount = count($seeders);
|
$seedersCount = count($seeders);
|
||||||
$leechersCount = count($downloaders);
|
$leechersCount = count($downloaders);
|
||||||
if ($torrent->seeders != $seedersCount || $torrent->leechers != $leechersCount) {
|
if ($torrent->seeders != $seedersCount || $torrent->leechers != $leechersCount) {
|
||||||
|
|||||||
Reference in New Issue
Block a user