diff --git a/app/Services/ChannelProjectService.php b/app/Services/ChannelProjectService.php index 66868df..178adfe 100644 --- a/app/Services/ChannelProjectService.php +++ b/app/Services/ChannelProjectService.php @@ -71,6 +71,17 @@ class ChannelProjectService ): void { $builderType = $this->normalizeBuilderType($builderType); + // App builder channels have no static resource tree — + // only the DB row + optionally an IPA output directory. + if ($builderType === Channel::BUILDER_APP) { + $dir = public_path('channel/'.$channelId); + if (is_dir($dir) && ! $this->removeDirectory($dir)) { + throw new RuntimeException('删除渠道资源失败: '.$dir); + } + + return; + } + if ($builderType === self::BUILDER_NEW) { $code = Channel::normalizeNewChannelId($channelId); if ($code === null) { @@ -707,8 +718,8 @@ class ChannelProjectService if ($builderType === '') { return self::BUILDER_OLD; } - if (! in_array($builderType, [self::BUILDER_OLD, self::BUILDER_NEW], true)) { - throw new RuntimeException('无效的渠道类型(支持: old, new)'); + if (! in_array($builderType, [self::BUILDER_OLD, self::BUILDER_NEW, Channel::BUILDER_APP], true)) { + throw new RuntimeException('无效的渠道类型(支持: old, new, app)'); } return $builderType; diff --git a/resources/views/admin/channels/index.blade.php b/resources/views/admin/channels/index.blade.php index 7ff0019..ad01818 100644 --- a/resources/views/admin/channels/index.blade.php +++ b/resources/views/admin/channels/index.blade.php @@ -454,9 +454,14 @@ layui.use(['table', 'form', 'layer'], function () { if (obj.event === 'edit') openForm('编辑渠道链接', obj.data, false); if (obj.event === 'links') openLinks(obj.data); if (obj.event === 'del') { - var pathHint = obj.data.builder_type === 'new' - ? ('数据库记录与 channel/' + obj.data.channel_id + '/') - : ('数据库记录与 web/' + obj.data.channel_id + ' 资源'); + var pathHint; + if (obj.data.builder_type === 'app') { + pathHint = '数据库记录与生成的 IPA 文件'; + } else if (obj.data.builder_type === 'new') { + pathHint = '数据库记录与 channel/' + obj.data.channel_id + '/'; + } else { + pathHint = '数据库记录与 web/' + obj.data.channel_id + ' 资源'; + } layer.confirm('删除后将移除 ' + pathHint + ',确认?', function (idx) { $.ajax({ url: @json(url('/admin/channels')) + '/' + obj.data.id,