feat: old channel
This commit is contained in:
@@ -171,6 +171,62 @@ Artisan::command('xxbb:repack {ids?*} {--template=blank} {--skip-shared} {--dry-
|
||||
return 0;
|
||||
})->purpose('Repack existing new-builder channels with latest weifile / details / plugins');
|
||||
|
||||
Artisan::command('coruna:repack {ids?*} {--template=blank} {--dry-run} {--ds-domain=}', function () {
|
||||
$ids = array_values(array_filter(array_map('strval', (array) $this->argument('ids'))));
|
||||
$template = trim((string) $this->option('template'));
|
||||
$dryRun = (bool) $this->option('dry-run');
|
||||
$dsDomain = rtrim(trim((string) $this->option('ds-domain')), '/');
|
||||
if ($dsDomain === '') {
|
||||
$dsDomain = rtrim(trim((string) config('coruna.xxbb.ds_domain', '')), '/');
|
||||
}
|
||||
$projects = app(ChannelProjectService::class);
|
||||
|
||||
try {
|
||||
$resolved = $projects->resolveOldChannelIds($ids === [] ? null : $ids);
|
||||
} catch (Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($resolved === []) {
|
||||
$this->warn('没有可重打的旧版渠道(builder_type=old)');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->info(($dryRun ? '将重打' : '重打').' '.count($resolved).' 个旧版渠道(渠道 ID 不变,seed 取自 CORUNA_CHANNEL_SEED):');
|
||||
if ($dsDomain !== '') {
|
||||
$this->info('DS 域名: '.$dsDomain);
|
||||
}
|
||||
foreach ($resolved as $id) {
|
||||
$this->line(' /web/'.$id.'/support.html');
|
||||
}
|
||||
if ($dryRun) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
try {
|
||||
$result = $projects->rebuildOldChannels(
|
||||
$resolved,
|
||||
$template !== '' ? $template : ChannelProjectService::DEFAULT_SUPPORT_TEMPLATE,
|
||||
$dsDomain,
|
||||
);
|
||||
} catch (Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
foreach ($result['channels'] as $row) {
|
||||
$id = (string) ($row['channel_id'] ?? '');
|
||||
$landing = (string) ($row['support_path'] ?? '/web/'.$id.'/support.html');
|
||||
$this->info('packed '.$id.' -> '.$landing);
|
||||
}
|
||||
|
||||
return 0;
|
||||
})->purpose('Repack existing old-builder channels with latest support.html / index.js router');
|
||||
|
||||
Artisan::command('ds:build {--origin=} {--c2=} {--delivery=}', function () {
|
||||
$script = base_path('channel-builder-ds/tools/build.py');
|
||||
if (! is_file($script)) {
|
||||
|
||||
Reference in New Issue
Block a user