15m44v 附件走图床嵌真实图片: GitHub 模式附件也传图床拿URL, issue body 用 ![](url) 显示实际图片(图床没配才回退 @gh: 占位)

This commit is contained in:
ypsdf1
2026-11-25 16:42:57 +08:00
parent df37f3ae32
commit 8543f8e573
4 changed files with 34 additions and 14 deletions
+6 -1
View File
@@ -165,9 +165,14 @@ function ghSyncCreate($ticketId, $player, $title, $description, $images = [], $t
$bodyParts[] = '';
foreach ($images as $i => $u) {
if (is_string($u) && strpos($u, '@gh:') === 0) {
// @gh:附件图N:文件名.png → 取冒号后的文件名展示
// @gh:附件图N:文件名(图床没配时的回退占位)→ 只显示文件名,让玩家去 GitHub 传原图
$label = str_replace('@gh:', '', $u);
$bodyParts[] = '📎 附件' . ($i + 1) . ':`' . $label . '`(需在 GitHub issue 上传原图)';
} elseif (is_string($u) && (strpos($u, 'http://') === 0 || strpos($u, 'https://') === 0)) {
// ★ 15m44v: 真实图床 URL → markdown 图片语法嵌进 issue body。
// GitHub 会把 ![](外链) 的图片自动转存到 user-images.githubusercontent.com CDN,
// issue 页正常显示实际图片(不再只是文件名)。
$bodyParts[] = '附件' . ($i + 1) . ':' . "\n" . '![' . $u . '](' . $u . ')';
} else {
$bodyParts[] = '附件图' . ($i + 1) . ':' . $u;
}