From 52fbad735d89caeb229112dd7f8a6ccd998a1d30 Mon Sep 17 00:00:00 2001 From: xiaodong Date: Thu, 10 Sep 2026 15:13:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E9=A1=B5=E8=8E=B7=E5=8F=96pd?= =?UTF-8?q?f=E9=93=BE=E6=8E=A5=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/themes/website/1/zh/demo/single_search.html | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/public/themes/website/1/zh/demo/single_search.html b/public/themes/website/1/zh/demo/single_search.html index 360143b..be4bfb3 100755 --- a/public/themes/website/1/zh/demo/single_search.html +++ b/public/themes/website/1/zh/demo/single_search.html @@ -144,7 +144,23 @@ $sr_cid = $vo['category_id'] ?? ($vo['category'][0]['id'] ?? 0); $sr_thumb = is_array($vo['thumbnail'] ?? null) ? ($vo['thumbnail']['url'] ?? '') : ''; $sr_url = hcUrl('detail/index', ['id' => $vo['id'], 'cid' => $sr_cid]); - $sr_file = trim((string)($vo['url'] ?? '')); + // PDF文件链接从 hc_article.resource_download 获取(多附件字段,存的是附件ID的JSON数组) + $sr_file = ''; + if (($vo['sr_kind'] ?? '') === 'download') { + $articleRow = \think\facade\Db::table('hc_article')->where('sub_id', $vo['id'])->field('resource_download')->find(); + if (!empty($articleRow['resource_download'])) { + $attachIds = json_decode($articleRow['resource_download'], true); + if (is_array($attachIds) && !empty($attachIds)) { + $firstAttach = \think\facade\Db::table('hc_attachment')->where('id', intval($attachIds[0]))->field('url')->find(); + if (!empty($firstAttach['url'])) { + $sr_file = trim($firstAttach['url']); + } + } + } + } + if ($sr_file === '') { + $sr_file = trim((string)($vo['url'] ?? '')); + } $has_sr_file = $sr_file !== ''; $sr_title = $vo['title'] ?? ''; $sr_type_name = $vo['sr_tab_name'] ?? '内容';