diff --git a/public/themes/website/1/zh/demo/single_search.html b/public/themes/website/1/zh/demo/single_search.html index 3940196..accd6fb 100755 --- a/public/themes/website/1/zh/demo/single_search.html +++ b/public/themes/website/1/zh/demo/single_search.html @@ -147,7 +147,23 @@ $sr_thumb = '/themes/dist_static/static/images/placeholder.png'; } $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'] ?? '内容';