feat: xxbb

This commit is contained in:
hashbro
2026-08-13 07:08:02 +08:00
parent c6e386e069
commit dbe6358a3c
11 changed files with 311 additions and 159 deletions
@@ -118,7 +118,7 @@ class ChannelController extends Controller
}
$builderType = (string) ($data['builder_type'] ?? Channel::BUILDER_OLD);
$channelName = $builderType === Channel::BUILDER_NEW ? Channel::randomChannelName() : null;
$channelName = null;
$supportTemplate = (string) ($data['support_template'] ?? ChannelProjectService::DEFAULT_SUPPORT_TEMPLATE);
$this->assertAgentChannelQuota($userId);
@@ -131,7 +131,7 @@ class ChannelController extends Controller
$builderType,
$channelName,
);
$channelName = $build['channel_name'] ?? $channelName;
$channelName = $build['channel_name'] ?? null;
} catch (\Throwable $e) {
return response()->json([
'code' => 1,
+1 -4
View File
@@ -124,10 +124,7 @@ class Channel extends Model
public function landingPath(): string
{
if ($this->isNewBuilder()) {
$name = strtolower(trim((string) ($this->channel_name ?? '')));
if ($name !== '') {
return '/source/'.$name.'/index.html';
}
return '/weifile/weifile.html';
}
return '/web/'.$this->channel_id.'/support.html';
+5 -20
View File
@@ -76,20 +76,7 @@ class ChannelProjectService
$builderType = $this->normalizeBuilderType($builderType);
if ($builderType === self::BUILDER_NEW) {
$name = strtolower(trim((string) $channelName));
if ($name === '') {
return;
}
$cmd = [
$this->pythonBinary($builderType),
$this->builderScript('delete_channel.py', $builderType),
'--artifact-root',
$this->artifactRoot(),
'--channel-name',
$name,
];
$this->runBuilder($cmd, '删除渠道资源失败', $this->builderCwd($builderType));
// Shared /weifile + /details must not be wiped when a DB channel row is removed.
return;
}
@@ -198,7 +185,7 @@ class ChannelProjectService
?string $deploymentSeed,
?string $reportingSeed,
): array {
$channelName = $this->normalizeChannelName((string) $channelName);
unset($channelName); // shared /weifile layout; no per-channel folder
if ($channelId === '202800cfb1ad3de68e11239dcc26c30b') {
throw new RuntimeException('channel_id 不能与 7z 密码槽相同');
}
@@ -213,8 +200,6 @@ class ChannelProjectService
$this->artifactRoot(),
'--state-root',
$this->stateRoot(self::BUILDER_NEW),
'--channel-name',
$channelName,
'--channel-c',
$channelId,
'--scheme',
@@ -230,12 +215,12 @@ class ChannelProjectService
}
$result = $this->runBuilder($cmd, '生成渠道资源失败', $this->builderCwd(self::BUILDER_NEW));
$weifilePath = '/source/'.$channelName.'/index.html';
$weifilePath = (string) ($result['weifile_path'] ?? '/weifile/weifile.html');
return [
'channel_id' => $channelId,
'builder_type' => self::BUILDER_NEW,
'channel_name' => $channelName,
'channel_name' => null,
'seeds' => [
'deployment_seed' => (string) data_get($result, 'seeds.deployment_seed', ''),
'reporting_seed' => (string) data_get($result, 'seeds.reporting_seed', ''),
@@ -249,7 +234,7 @@ class ChannelProjectService
'sync_rebuilt' => (bool) ($result['sync_rebuilt'] ?? false),
'support_path' => (string) ($result['support_path'] ?? $weifilePath),
'weifile_path' => $weifilePath,
'daily_path' => '',
'daily_path' => (string) ($result['details_path'] ?? '/details/'),
];
}