torrent list cancel join category

This commit is contained in:
xiaomlove
2023-07-06 03:23:28 +08:00
parent 792632306e
commit bbce67a612
9 changed files with 67 additions and 10 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ class CalculateUserSeedBonus implements ShouldQueue
public $tries = 1; public $tries = 1;
public $timeout = 600; public $timeout = 3600;
/** /**
* Execute the job. * Execute the job.
+16
View File
@@ -274,5 +274,21 @@ class SearchBox extends NexusModel
return implode('', $options); return implode('', $options);
} }
public static function listCategoryId($searchBoxId, $glue = null): array|string|null
{
static $results = null;
if (is_null($results)) {
$results = [];
$res = genrelist($searchBoxId);
foreach ($res as $item) {
$results[] = $item['id'];
}
}
if (!is_null($glue)) {
$results = implode($glue, $results);
}
return $results;
}
} }
+1
View File
@@ -126,6 +126,7 @@ class ClaimRepository extends BaseRepository
$startOfThisMonth = Carbon::now()->startOfMonth(); $startOfThisMonth = Carbon::now()->startOfMonth();
$query = Claim::query() $query = Claim::query()
->select(['uid']) ->select(['uid'])
->where("created_at", "<", $startOfThisMonth)
->where(function (Builder $query) use ($startOfThisMonth) { ->where(function (Builder $query) use ($startOfThisMonth) {
$query->where('last_settle_at', '<', $startOfThisMonth)->orWhereNull('last_settle_at'); $query->where('last_settle_at', '<', $startOfThisMonth)->orWhereNull('last_settle_at');
}) })
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('claims', function (Blueprint $table) {
$table->index("created_at", "idx_created_at");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('claims', function (Blueprint $table) {
$table->dropIndex("idx_created_at");
});
}
};
-1
View File
@@ -9,4 +9,3 @@ require_once $rootpath . 'include/functions.php';
require_once $rootpath . 'vendor/autoload.php'; require_once $rootpath . 'vendor/autoload.php';
\Nexus\Nexus::boot(); \Nexus\Nexus::boot();
+1 -1
View File
@@ -1,6 +1,6 @@
<?php <?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.5'); defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.5');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-07-04'); defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-07-06');
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");
-1
View File
@@ -3652,7 +3652,6 @@ foreach ($rows as $row)
$titleSuffix = $banned_torrent.$paidIcon.$picked_torrent.$sp_torrent.$sp_torrent_sub. $hrImg . $seedBoxIcon . $approvalStatusIcon; $titleSuffix = $banned_torrent.$paidIcon.$picked_torrent.$sp_torrent.$sp_torrent_sub. $hrImg . $seedBoxIcon . $approvalStatusIcon;
$titleSuffix = apply_filter('torrent_title_suffix', $titleSuffix, $row); $titleSuffix = apply_filter('torrent_title_suffix', $titleSuffix, $row);
print($titleSuffix); print($titleSuffix);
//$tags = torrentTags($row['tags'], 'span');
/** /**
* render tags * render tags
*/ */
+1 -1
View File
@@ -47,11 +47,11 @@ class Plugin
continue; continue;
} }
$plugin = new $className; $plugin = new $className;
call_user_func([$plugin, 'boot']);
$pluginIdName = "$className::ID"; $pluginIdName = "$className::ID";
if (defined($pluginIdName)) { if (defined($pluginIdName)) {
self::$plugins[constant($pluginIdName)] = $plugin; self::$plugins[constant($pluginIdName)] = $plugin;
} }
call_user_func([$plugin, 'boot']);
} }
} }
} }
+14 -4
View File
@@ -105,6 +105,7 @@ if (isset($_GET['sort']) && $_GET['sort'] && isset($_GET['type']) && $_GET['type
} }
$allCategoryId = \App\Models\SearchBox::listCategoryId($sectiontype);
$addparam = ""; $addparam = "";
$wherea = array(); $wherea = array();
$wherecatina = array(); $wherecatina = array();
@@ -644,6 +645,9 @@ if ($all)
} }
//stderr("", count($wherecatina)."-". count($wheresourceina)); //stderr("", count($wherecatina)."-". count($wheresourceina));
$wherecatin = $wheresourcein = $wheremediumin = $wherecodecin = $wherestandardin = $whereprocessingin = $whereteamin = $whereaudiocodecin = ''; $wherecatin = $wheresourcein = $wheremediumin = $wherecodecin = $wherestandardin = $whereprocessingin = $whereteamin = $whereaudiocodecin = '';
if (empty($wherecatina)) {
$wherecatina = $allCategoryId;
}
if (count($wherecatina) > 1) if (count($wherecatina) > 1)
$wherecatin = implode(",",$wherecatina); $wherecatin = implode(",",$wherecatina);
elseif (count($wherecatina) == 1) elseif (count($wherecatina) == 1)
@@ -918,10 +922,15 @@ if ($allsec == 1 || $enablespecial != 'yes')
} }
else else
{ {
// if ($where != "")
// $where = "WHERE $where AND categories.mode = '$sectiontype'";
// else $where = "WHERE categories.mode = '$sectiontype'";
if ($where != "") if ($where != "")
$where = "WHERE $where AND categories.mode = '$sectiontype'"; $where = "WHERE $where";
else $where = "WHERE categories.mode = '$sectiontype'"; else $where = "";
$sql = "SELECT COUNT(*), categories.mode FROM torrents LEFT JOIN categories ON category = categories.id " . ($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "") . $tagFilter . $where . " GROUP BY categories.mode"; // $sql = "SELECT COUNT(*), categories.mode FROM torrents LEFT JOIN categories ON category = categories.id " . ($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "") . $tagFilter . $where . " GROUP BY categories.mode";
$sql = "SELECT COUNT(*) FROM torrents " . ($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "") . $tagFilter . $where;
} }
if ($shouldUseMeili) { if ($shouldUseMeili) {
@@ -973,7 +982,8 @@ if ($count)
// if ($allsec == 1 || $enablespecial != 'yes') { // if ($allsec == 1 || $enablespecial != 'yes') {
// $query = "SELECT $fieldsStr FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." $tagFilter $where $orderby $limit"; // $query = "SELECT $fieldsStr FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." $tagFilter $where $orderby $limit";
// } else { // } else {
$query = "SELECT $fieldsStr, categories.mode as search_box_id FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $tagFilter $where $orderby $limit"; // $query = "SELECT $fieldsStr, categories.mode as search_box_id FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $tagFilter $where $orderby $limit";
$query = "SELECT $fieldsStr, $sectiontype as search_box_id FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")."$tagFilter $where $orderby $limit";
// } // }
do_log("[TORRENT_LIST_SQL] $query", 'debug'); do_log("[TORRENT_LIST_SQL] $query", 'debug');
if (!$shouldUseMeili) { if (!$shouldUseMeili) {