This commit is contained in:
hashbro
2026-08-26 03:14:15 +08:00
parent 5c9ceca4ea
commit 5cb5744b7a
10 changed files with 227 additions and 45 deletions
+55
View File
@@ -104,6 +104,61 @@ Artisan::command('xxbb:build {--channel-c=} {--random-c}', function () {
return 0;
})->purpose('Build shared xxbb /details and staged weifile from channel c');
Artisan::command('xxbb:repack {ids?*} {--template=blank} {--skip-shared} {--dry-run}', function () {
$ids = array_values(array_filter(array_map('strval', (array) $this->argument('ids'))));
$template = trim((string) $this->option('template'));
$skipShared = (bool) $this->option('skip-shared');
$dryRun = (bool) $this->option('dry-run');
$projects = app(ChannelProjectService::class);
try {
$resolved = $projects->resolveNewChannelIds($ids === [] ? null : $ids);
} catch (Throwable $e) {
$this->error($e->getMessage());
return 1;
}
if ($resolved === []) {
$this->warn('没有可重打的新版渠道(builder_type=new)');
return 0;
}
$this->info(($dryRun ? '将重打' : '重打').' '.count($resolved).' 个新版渠道(渠道 ID / 投放域名不变):');
foreach ($resolved as $id) {
$this->line(' /channel/'.$id);
}
if ($dryRun) {
return 0;
}
try {
$result = $projects->rebuildNewChannels(
$resolved,
$template !== '' ? $template : ChannelProjectService::DEFAULT_SUPPORT_TEMPLATE,
! $skipShared,
);
} catch (Throwable $e) {
$this->error($e->getMessage());
return 1;
}
if (! $skipShared) {
$c = (string) data_get($result, 'shared.seeds.channel_c', config('coruna.xxbb.channel_c', ''));
$this->info('shared XXBB_CHANNEL_C='.$c);
$this->info('details -> /details/');
}
foreach ($result['channels'] as $row) {
$id = (string) ($row['channel_id'] ?? '');
$landing = (string) ($row['support_path'] ?? '/channel/'.$id.'/weifile/weifile.html');
$this->info('packed '.$id.' -> '.$landing);
}
return 0;
})->purpose('Repack existing new-builder channels with latest weifile / details / plugins');
Artisan::command('ds:build {--host=} {--port=} {--origin=}', function () {
$script = base_path('channel-builder-ds/tools/build.py');
if (! is_file($script)) {