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

View File

@@ -46,7 +46,7 @@ class CalculateUserSeedBonus implements ShouldQueue
public $tries = 1;
public $timeout = 600;
public $timeout = 3600;
/**
* Execute the job.

View File

@@ -274,5 +274,21 @@ class SearchBox extends NexusModel
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;
}
}

View File

@@ -126,6 +126,7 @@ class ClaimRepository extends BaseRepository
$startOfThisMonth = Carbon::now()->startOfMonth();
$query = Claim::query()
->select(['uid'])
->where("created_at", "<", $startOfThisMonth)
->where(function (Builder $query) use ($startOfThisMonth) {
$query->where('last_settle_at', '<', $startOfThisMonth)->orWhereNull('last_settle_at');
})

View File

@@ -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");
});
}
};

View File

@@ -9,4 +9,3 @@ require_once $rootpath . 'include/functions.php';
require_once $rootpath . 'vendor/autoload.php';
\Nexus\Nexus::boot();

View File

@@ -1,6 +1,6 @@
<?php
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('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");

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 = apply_filter('torrent_title_suffix', $titleSuffix, $row);
print($titleSuffix);
//$tags = torrentTags($row['tags'], 'span');
/**
* render tags
*/

View File

@@ -47,11 +47,11 @@ class Plugin
continue;
}
$plugin = new $className;
call_user_func([$plugin, 'boot']);
$pluginIdName = "$className::ID";
if (defined($pluginIdName)) {
self::$plugins[constant($pluginIdName)] = $plugin;
}
call_user_func([$plugin, 'boot']);
}
}
}

View File

@@ -105,6 +105,7 @@ if (isset($_GET['sort']) && $_GET['sort'] && isset($_GET['type']) && $_GET['type
}
$allCategoryId = \App\Models\SearchBox::listCategoryId($sectiontype);
$addparam = "";
$wherea = array();
$wherecatina = array();
@@ -644,6 +645,9 @@ if ($all)
}
//stderr("", count($wherecatina)."-". count($wheresourceina));
$wherecatin = $wheresourcein = $wheremediumin = $wherecodecin = $wherestandardin = $whereprocessingin = $whereteamin = $whereaudiocodecin = '';
if (empty($wherecatina)) {
$wherecatina = $allCategoryId;
}
if (count($wherecatina) > 1)
$wherecatin = implode(",",$wherecatina);
elseif (count($wherecatina) == 1)
@@ -918,10 +922,15 @@ if ($allsec == 1 || $enablespecial != 'yes')
}
else
{
if ($where != "")
$where = "WHERE $where AND categories.mode = '$sectiontype'";
else $where = "WHERE categories.mode = '$sectiontype'";
$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";
// if ($where != "")
// $where = "WHERE $where AND categories.mode = '$sectiontype'";
// else $where = "WHERE categories.mode = '$sectiontype'";
if ($where != "")
$where = "WHERE $where";
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(*) FROM torrents " . ($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "") . $tagFilter . $where;
}
if ($shouldUseMeili) {
@@ -973,7 +982,8 @@ if ($count)
// 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";
// } 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');
if (!$shouldUseMeili) {