mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
announce log menu only show when enabled
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Filament\Resources\Torrent;
|
||||
use App\Filament\Resources\Torrent\AnnounceLogResource\Pages;
|
||||
use App\Filament\Resources\Torrent\AnnounceLogResource\RelationManagers;
|
||||
use App\Models\AnnounceLog;
|
||||
use App\Models\Setting;
|
||||
use App\Models\Torrent;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
@@ -39,6 +40,14 @@ class AnnounceLogResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function shouldRegisterNavigation(): bool
|
||||
{
|
||||
return Setting::getIsRecordAnnounceLog() && config('clickhouse.connection.host') != '';
|
||||
}
|
||||
|
||||
public static function infolist(Infolist $infolist): Infolist
|
||||
{
|
||||
return $infolist
|
||||
|
||||
@@ -234,9 +234,13 @@ class CalculateUserSeedBonus implements ShouldQueue
|
||||
do_log("clickhouse no host");
|
||||
return;
|
||||
}
|
||||
$client = app(\ClickHouseDB\Client::class);
|
||||
$fields = ['business_type', 'uid', 'old_total_value', 'value', 'new_total_value', 'comment', 'created_at'];
|
||||
$client->insert("bonus_logs", $bonusLogInsert, $fields);
|
||||
do_log("insertIntoClickHouseBulk done, created_at: {$bonusLogInsert[0]['created_at']}");
|
||||
try {
|
||||
$client = app(\ClickHouseDB\Client::class);
|
||||
$fields = ['business_type', 'uid', 'old_total_value', 'value', 'new_total_value', 'comment', 'created_at'];
|
||||
$client->insert("bonus_logs", $bonusLogInsert, $fields);
|
||||
do_log("insertIntoClickHouseBulk done, created_at: {$bonusLogInsert[0]['created_at']}");
|
||||
} catch (\Exception $e) {
|
||||
do_log($e->getMessage(), 'error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user