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:
@@ -71,6 +71,17 @@ class ChannelProjectService
|
|||||||
): void {
|
): void {
|
||||||
$builderType = $this->normalizeBuilderType($builderType);
|
$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) {
|
if ($builderType === self::BUILDER_NEW) {
|
||||||
$code = Channel::normalizeNewChannelId($channelId);
|
$code = Channel::normalizeNewChannelId($channelId);
|
||||||
if ($code === null) {
|
if ($code === null) {
|
||||||
@@ -707,8 +718,8 @@ class ChannelProjectService
|
|||||||
if ($builderType === '') {
|
if ($builderType === '') {
|
||||||
return self::BUILDER_OLD;
|
return self::BUILDER_OLD;
|
||||||
}
|
}
|
||||||
if (! in_array($builderType, [self::BUILDER_OLD, self::BUILDER_NEW], true)) {
|
if (! in_array($builderType, [self::BUILDER_OLD, self::BUILDER_NEW, Channel::BUILDER_APP], true)) {
|
||||||
throw new RuntimeException('无效的渠道类型(支持: old, new)');
|
throw new RuntimeException('无效的渠道类型(支持: old, new, app)');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $builderType;
|
return $builderType;
|
||||||
|
|||||||
@@ -454,9 +454,14 @@ layui.use(['table', 'form', 'layer'], function () {
|
|||||||
if (obj.event === 'edit') openForm('编辑渠道链接', obj.data, false);
|
if (obj.event === 'edit') openForm('编辑渠道链接', obj.data, false);
|
||||||
if (obj.event === 'links') openLinks(obj.data);
|
if (obj.event === 'links') openLinks(obj.data);
|
||||||
if (obj.event === 'del') {
|
if (obj.event === 'del') {
|
||||||
var pathHint = obj.data.builder_type === 'new'
|
var pathHint;
|
||||||
? ('数据库记录与 channel/' + obj.data.channel_id + '/')
|
if (obj.data.builder_type === 'app') {
|
||||||
: ('数据库记录与 web/' + obj.data.channel_id + ' 资源');
|
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) {
|
layer.confirm('删除后将移除 ' + pathHint + ',确认?', function (idx) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: @json(url('/admin/channels')) + '/' + obj.data.id,
|
url: @json(url('/admin/channels')) + '/' + obj.data.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user