mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
user add last_announce_at/seeding_torrent_count/seeding_torrent_size
This commit is contained in:
@@ -14,6 +14,7 @@ use App\Repositories\ExamRepository;
|
||||
use App\Repositories\SeedBoxRepository;
|
||||
use App\Repositories\UploadRepository;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Nexus\PTGen\PTGen;
|
||||
use NexusPlugin\Menu\Filament\MenuItemResource\Pages\ManageMenuItems;
|
||||
use NexusPlugin\Menu\MenuRepository;
|
||||
@@ -59,7 +60,15 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$failedJob = DB::table('failed_jobs')->find(555);
|
||||
|
||||
$payload = json_decode($failedJob->payload, true);
|
||||
dd($payload);
|
||||
|
||||
$base64 = $payload['data']['command'];
|
||||
$job = unserialize($base64);
|
||||
|
||||
dd($job);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class AuthCodeResource extends Resource
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('user.username')
|
||||
Tables\Columns\TextColumn::make('user_id')
|
||||
->label(__('label.username'))
|
||||
->formatStateUsing(fn ($record) => username_for_admin($record->user_id)),
|
||||
Tables\Columns\TextColumn::make('client.name')
|
||||
|
||||
@@ -90,6 +90,7 @@ class CalculateUserSeedBonus implements ShouldQueue
|
||||
do_log("$logPrefix, [GET_UID_REAL], count: " . count($results) . ", logFile: $logFile");
|
||||
$fd = fopen($logFile, 'a');
|
||||
$seedPointsUpdates = $seedPointsPerHourUpdates = $seedBonusUpdates = [];
|
||||
$seedingTorrentCountUpdates = $seedingTorrentSizeUpdates = [];
|
||||
$logStr = "";
|
||||
foreach ($results as $userInfo)
|
||||
{
|
||||
@@ -129,6 +130,8 @@ class CalculateUserSeedBonus implements ShouldQueue
|
||||
// NexusDB::statement($sql);
|
||||
$seedPointsUpdates[] = sprintf("when %d then ifnull(seed_points, 0) + %f", $uid, $seed_points);
|
||||
$seedPointsPerHourUpdates[] = sprintf("when %d then %f", $uid, $seedBonusResult['seed_points']);
|
||||
$seedingTorrentCountUpdates[] = sprintf("when %d then %f", $uid, $seedBonusResult['count']);
|
||||
$seedingTorrentSizeUpdates[] = sprintf("when %d then %f", $uid, $seedBonusResult['size']);
|
||||
$seedBonusUpdates[] = sprintf("when %d then seedbonus + %f", $uid, $all_bonus);
|
||||
if ($fd) {
|
||||
$log = sprintf(
|
||||
@@ -145,8 +148,8 @@ class CalculateUserSeedBonus implements ShouldQueue
|
||||
}
|
||||
$nowStr = now()->toDateTimeString();
|
||||
$sql = sprintf(
|
||||
"update users set seed_points = case id %s end, seed_points_per_hour = case id %s end, seedbonus = case id %s end, seed_points_updated_at = '%s' where id in (%s)",
|
||||
implode(" ", $seedPointsUpdates), implode(" ", $seedPointsPerHourUpdates), implode(" ", $seedBonusUpdates), $nowStr, $idStr
|
||||
"update users set seed_points = case id %s end, seed_points_per_hour = case id %s end, seedbonus = case id %s end, seeding_torrent_count = case id %s end, seeding_torrent_size = case id %s end, seed_points_updated_at = '%s' where id in (%s)",
|
||||
implode(" ", $seedPointsUpdates), implode(" ", $seedPointsPerHourUpdates), implode(" ", $seedBonusUpdates), implode(" ", $seedingTorrentCountUpdates), implode(" ", $seedingTorrentSizeUpdates), $nowStr, $idStr
|
||||
);
|
||||
$result = NexusDB::statement($sql);
|
||||
if ($delIdRedisKey) {
|
||||
|
||||
@@ -12,7 +12,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CheckCleanup implements ShouldQueue
|
||||
class CheckCleanup
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace App\Repositories;
|
||||
|
||||
class UpgradeRepository extends BaseRepository
|
||||
{
|
||||
const DATETIME_INVALID_VALUE_FIELDS = [
|
||||
'comments' => ['editdate'],
|
||||
'invites' => ['time_invited'],
|
||||
'offers' => ['allowedtime'],
|
||||
'peers' => ['last_action', 'prev_action'],
|
||||
'posts' => ['editdate'],
|
||||
'snatched' => ['last_action', 'completedat'],
|
||||
'torrents' => ['last_action', 'promotion_until', 'picktime', 'last_reseed'],
|
||||
'users' => [
|
||||
'last_login', 'last_access', 'last_home', 'last_offer', 'forum_access', 'last_staffmsg',
|
||||
'last_pm', 'last_comment', 'last_post', 'donoruntil', 'warneduntil', 'noaduntil', 'vip_until',
|
||||
'leechwarnuntil', 'lastwarned',
|
||||
],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user