15m44n 互斥二选一: type=GitHub时附件全走issue不走图床(easy关+@gh占位名+前端切文案)

This commit is contained in:
ypsdf1
2026-11-25 13:05:06 +08:00
parent 00f4db3d3b
commit c21b35c676
4 changed files with 66 additions and 10 deletions
+10 -2
View File
@@ -105,13 +105,21 @@ function ghSyncCreate($ticketId, $player, $title, $description, $images = [], $t
}
$repo = $cfg['gh_repo'];
$ghTitle = GH_TICKET_PREFIX . $ticketId . '] ' . $title;
// issue body:玩家名 + 描述 + 图片链接(GitHub issue 支持 markdown 图片)
// issue body:玩家名 + 描述 + 附件
// - @gh: 开头 = GitHub 模式占位附件(只记文件名,不走图床)→ 显示为「📎 附件:文件名」
// - http(s) = 真实图床外链 → 用 markdown 图片语法
$bodyParts = ['玩家:`' . $player . '`', ''];
if ($description !== '') $bodyParts[] = $description;
if (is_array($images) && count($images) > 0) {
$bodyParts[] = '';
foreach ($images as $i => $u) {
$bodyParts[] = '附件图' . ($i + 1) . ':' . $u;
if (is_string($u) && strpos($u, '@gh:') === 0) {
// @gh:附件图N:文件名.png → 取冒号后的文件名展示
$label = str_replace('@gh:', '', $u);
$bodyParts[] = '📎 附件' . ($i + 1) . ':`' . $label . '`(需在 GitHub issue 上传原图)';
} else {
$bodyParts[] = '附件图' . ($i + 1) . ':' . $u;
}
}
}
$payload = ['title' => mb_substr($ghTitle, 0, 100), 'body' => implode("\n", $bodyParts)];