fix: support App builder type in deleteWebTree + correct delete prompt

- ChannelProjectService: normalizeBuilderType accepts 'app' (Channel::BUILDER_APP)
- deleteWebTree: app type deletes public/channel/<id>/ (IPA output)
- Blade: correct pathHint for app builder type
This commit is contained in:
hashbro
2026-10-06 06:45:16 +08:00
parent 08ef9e718e
commit ba444a96b1
2 changed files with 21 additions and 5 deletions
+13 -2
View File
@@ -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;
@@ -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,