feat: old channel
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Http\Controllers\Concerns\PortalAware;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Channel;
|
||||
use App\Models\User;
|
||||
use App\Services\ChannelEmbedZipService;
|
||||
use App\Services\ChannelProjectService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -91,6 +92,10 @@ class ChannelController extends Controller
|
||||
'ipa_url' => file_exists(public_path('channel/'.$c->channel_id.'/app.ipa')) ? '/channel/'.$c->channel_id.'/app.ipa' : '',
|
||||
'links' => $c->supportLinks(),
|
||||
'landing_path' => $c->landingPath(),
|
||||
'embed_zip_url' => $c->embedAssetDir()
|
||||
? route($this->portal().'.channels.embedZip', $c)
|
||||
: '',
|
||||
'embed_script' => $c->isAppBuilder() ? '' : $c->promoScriptSnippet(),
|
||||
'created_at' => optional($c->created_at)->format('Y-m-d H:i:s'),
|
||||
'updated_at' => optional($c->updated_at)->format('Y-m-d H:i:s'),
|
||||
];
|
||||
@@ -225,6 +230,10 @@ class ChannelController extends Controller
|
||||
'daily_path' => $build['daily_path'] ?? '',
|
||||
'channel_dir' => $build['channel_dir'] ?? null,
|
||||
'show_alias' => $build['show_alias'] ?? null,
|
||||
'embed_zip_url' => $channel->embedAssetDir()
|
||||
? route($this->portal().'.channels.embedZip', $channel)
|
||||
: '',
|
||||
'embed_script' => $channel->promoScriptSnippet(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
@@ -443,8 +452,8 @@ class ChannelController extends Controller
|
||||
$build = $projects->generate(
|
||||
$channelId,
|
||||
$supportTemplate,
|
||||
$data['deployment_seed'] ?? null,
|
||||
$data['reporting_seed'] ?? null,
|
||||
null,
|
||||
null,
|
||||
$builderType,
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
@@ -498,6 +507,10 @@ class ChannelController extends Controller
|
||||
'daily_path' => $build['daily_path'] ?? '',
|
||||
'channel_dir' => $build['channel_dir'] ?? null,
|
||||
'show_alias' => $build['show_alias'] ?? null,
|
||||
'embed_zip_url' => $channel->embedAssetDir()
|
||||
? route($this->portal().'.channels.embedZip', $channel)
|
||||
: '',
|
||||
'embed_script' => $channel->promoScriptSnippet(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
@@ -554,6 +567,24 @@ class ChannelController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function downloadEmbed(Channel $channel, ChannelEmbedZipService $zips)
|
||||
{
|
||||
$this->authorizeChannel($channel);
|
||||
if ($channel->isAppBuilder()) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
try {
|
||||
$path = $zips->build($channel);
|
||||
} catch (\Throwable $e) {
|
||||
abort(404, $e->getMessage() ?: '打包失败');
|
||||
}
|
||||
|
||||
return response()->download($path, $channel->embedZipName(), [
|
||||
'Content-Type' => 'application/zip',
|
||||
])->deleteFileAfterSend(true);
|
||||
}
|
||||
|
||||
public function destroy(Channel $channel, ChannelProjectService $projects)
|
||||
{
|
||||
abort_if($this->isAgentPortal(), 403);
|
||||
|
||||
Reference in New Issue
Block a user