feat: old channel
This commit is contained in:
@@ -121,6 +121,7 @@ Route::prefix('admin')->name('admin.')->middleware('panel.host:admin')->group(fu
|
||||
Route::get('channels', [ChannelController::class, 'index'])->name('channels.index');
|
||||
Route::get('channels/data', [ChannelController::class, 'data'])->name('channels.data');
|
||||
Route::get('channels/random-id', [ChannelController::class, 'randomId'])->name('channels.randomId');
|
||||
Route::get('channels/{channel}/embed.zip', [ChannelController::class, 'downloadEmbed'])->name('channels.embedZip');
|
||||
Route::post('channels', [ChannelController::class, 'store'])->name('channels.store');
|
||||
Route::put('channels/{channel}', [ChannelController::class, 'update'])->name('channels.update');
|
||||
Route::delete('channels/{channel}', [ChannelController::class, 'destroy'])->name('channels.destroy');
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -109,6 +109,7 @@ Route::prefix('user')->name('user.')->middleware('panel.host:agent')->group(func
|
||||
|
||||
Route::get('channels', [ChannelController::class, 'index'])->name('channels.index');
|
||||
Route::get('channels/data', [ChannelController::class, 'data'])->name('channels.data');
|
||||
Route::get('channels/{channel}/embed.zip', [ChannelController::class, 'downloadEmbed'])->name('channels.embedZip');
|
||||
Route::put('channels/{channel}', [ChannelController::class, 'update'])->name('channels.update');
|
||||
// Agent portal: view/edit own channel links only (no create/delete).
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user