feat: new channel

This commit is contained in:
hashbro
2026-08-15 04:17:24 +08:00
parent a18f3dceb7
commit 9049fdccad
5 changed files with 76 additions and 5 deletions
+10 -3
View File
@@ -31,7 +31,7 @@ class ChannelCommand
return;
}
$lines = ['📎 渠道列表(点按钮复制链接)', ''];
$lines = ['📎 渠道列表(点按钮复制;新版=推广 iframe,旧版=投放链接)', ''];
$markup = InlineKeyboardMarkup::make();
foreach ($channels as $i => $channel) {
@@ -43,10 +43,17 @@ class ChannelCommand
$lines[] = ' 备注: '.$remarkLabel.' | 归属: '.$owner.' | '.$status;
if ($channel->isNewBuilder()) {
$btnText = ($remark !== '' ? mb_substr($remark, 0, 18) : $channel->channel_id).' · 渠道码';
$snippet = $channel->promoIframeSnippet();
if ($snippet === null || $snippet === '') {
$btnText = ($remark !== '' ? mb_substr($remark, 0, 18) : $channel->channel_id).' · 渠道码';
$copy = $channel->channel_id;
} else {
$btnText = ($remark !== '' ? mb_substr($remark, 0, 16) : $channel->channel_id).' · 推广代码';
$copy = strlen($snippet) > 256 ? substr($snippet, 0, 256) : $snippet;
}
$markup->addRow(InlineKeyboardButton::make(
text: $btnText,
copy_text: CopyTextButton::make($channel->channel_id),
copy_text: CopyTextButton::make($copy),
));
continue;