fix takereseed message

This commit is contained in:
xiaomlove
2025-06-09 19:16:43 +07:00
parent 56994c542a
commit 0386abb663
2 changed files with 27 additions and 12 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Console\Commands;
use App\Jobs\CheckQueueFailedJobs;
use App\Jobs\SettleClaim;
use App\Models\ExamUser;
use App\Models\Language;
@@ -60,15 +61,17 @@ class Test extends Command
*/
public function handle()
{
$failedJob = DB::table('failed_jobs')->find(555);
// $failedJob = DB::table('failed_jobs')->find(555);
//
// $payload = json_decode($failedJob->payload, true);
// dd($payload);
//
// $base64 = $payload['data']['command'];
// $job = unserialize($base64);
//
// dd($job);
$payload = json_decode($failedJob->payload, true);
dd($payload);
$base64 = $payload['data']['command'];
$job = unserialize($base64);
dd($job);
CheckQueueFailedJobs::dispatch();
}
}

View File

@@ -9,7 +9,8 @@ user_can('askreseed', true);
$reseedid = intval($_GET["reseedid"] ?? 0);
$res = sql_query("SELECT seeders, last_reseed FROM torrents WHERE id=".sqlesc($reseedid)." LIMIT 1") or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_array($res);
if ($row['seeders'] > 0)
$seederCount = get_row_count("peers", "where torrent = ".sqlesc($reseedid));
if ($seederCount > 0)
stderr($lang_takereseed['std_error'], $lang_takereseed['std_torrent_not_dead']);
elseif (strtotime($row['last_reseed']) > (TIMENOW - 900))
stderr($lang_takereseed['std_error'], $lang_takereseed['std_reseed_sent_recently']);
@@ -18,10 +19,21 @@ $res = sql_query("SELECT snatched.userid, snatched.torrentid, torrents.name as t
while($row = mysql_fetch_assoc($res)) {
$locale = get_user_locale($row['userid']);
$rs_subject = nexus_trans("torrent.msg_reseed_request", [], $locale);
$pn_msg = nexus_trans("torrent.msg_user", [], $locale).$CURUSER["username"].nexus_trans("user.msg_ask_reseed", [], $locale)."[url=" . get_protocol_prefix() . "$BASEURL/details.php?id=".$reseedid."]".$row["torrent_name"]."[/url]".nexus_trans("torrent.msg_thank_you", [], $locale);
sql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES(0, $row[userid], '" . date("Y-m-d H:i:s") . "'," . sqlesc($rs_subject) . ", " . sqlesc($pn_msg) . ")") or sqlerr(__FILE__, __LINE__);
$pn_msg = nexus_trans("torrent.msg_reseed_user", [], $locale).$CURUSER["username"].nexus_trans("torrent.msg_ask_reseed", [], $locale)."[url=" . get_protocol_prefix() . "$BASEURL/details.php?id=".$reseedid."]".$row["torrent_name"]."[/url]".nexus_trans("torrent.msg_thank_you", [], $locale);
//sql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES(0, $row[userid], '" . date("Y-m-d H:i:s") . "'," . sqlesc($rs_subject) . ", " . sqlesc($pn_msg) . ")") or sqlerr(__FILE__, __LINE__);
\App\Models\Message::add([
'sender' => 0,
'receiver' => $row['userid'],
'subject' => $rs_subject,
'msg' => $pn_msg,
'added' => now(),
]);
}
sql_query("UPDATE torrents SET last_reseed = ".sqlesc(date("Y-m-d H:i:s"))." WHERE id=".sqlesc($reseedid));
//sql_query("UPDATE torrents SET last_reseed = ".sqlesc(date("Y-m-d H:i:s"))." WHERE id=".sqlesc($reseedid));
\App\Models\Torrent::query()->where("id", $reseedid)->update([
"last_reseed" => now(),
"seeders" => $seederCount,
]);
stdhead($lang_takereseed['head_reseed_request']);
begin_main_frame();
print("<center>".$lang_takereseed['std_it_worked']."</center>");