fix: 修复 getBasic.inc.php 多余括号 & 重构研究报告卡片
- 删除 getBasic.inc.php 中残留的多余 `}` 导致部署后解析错误 - index-2.php: 删除 PDF报告卡片;研究报告卡片改为按日期子目录动态加载 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -100,8 +100,6 @@ function tscodeToName($ts_code){
|
|||||||
return $ts_code;
|
return $ts_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function getBasicExtData($ts_code,$item,$day_st,$day_end){
|
function getBasicExtData($ts_code,$item,$day_st,$day_end){
|
||||||
$mysqli = get_mysqli_connection();
|
$mysqli = get_mysqli_connection();
|
||||||
$allowed_items = ['total_mv','circ_mv','total_mv_all','circ_mv_all','pe_ttm','pb','ps','total_share','float_share','free_share'];
|
$allowed_items = ['total_mv','circ_mv','total_mv_all','circ_mv_all','pe_ttm','pb','ps','total_share','float_share','free_share'];
|
||||||
|
|||||||
+61
-98
@@ -196,112 +196,67 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- 研究报告数据卡片 -->
|
<!-- 研究报告数据卡片 -->
|
||||||
<div class="bg-white rounded-xl shadow-md p-6 card-hover">
|
<div class="bg-white rounded-xl shadow-md p-6 card-hover">
|
||||||
<div class="flex items-center mb-6">
|
<div class="flex items-center mb-4">
|
||||||
<div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
|
<div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
|
||||||
<i class="fa-solid fa-file-text text-indigo-600"></i>
|
<i class="fa-solid fa-file-text text-indigo-600"></i>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="text-lg font-semibold">研究报告</h3>
|
<h3 class="text-lg font-semibold">研究报告</h3>
|
||||||
</div>
|
</div>
|
||||||
|
<p class="text-gray-600 text-sm mb-4">按日期查看研究报告。</p>
|
||||||
<div class="mb-4 text-gray-600">
|
<?php
|
||||||
<p>以下是最新的市场研究报告,点击可查看详情。</p>
|
$researchDir = __DIR__ . '/research';
|
||||||
</div>
|
$dateDirs = [];
|
||||||
|
foreach (glob($researchDir . '/*', GLOB_ONLYDIR) as $d) {
|
||||||
<div class="space-y-3">
|
$bn = basename($d);
|
||||||
<?php
|
if (preg_match('/^\d{8}$/', $bn)) {
|
||||||
// 扫描research目录下的HTML文件并提取标题
|
$dateDirs[] = $bn;
|
||||||
$researchDir = __DIR__ . '/research';
|
|
||||||
$htmlFiles = glob($researchDir . '/*.html');
|
|
||||||
|
|
||||||
// 新增:扫描子目录中的index.html文件
|
|
||||||
$subDirs = glob($researchDir . '/*', GLOB_ONLYDIR);
|
|
||||||
foreach ($subDirs as $dir) {
|
|
||||||
$indexFile = $dir . '/index.html';
|
|
||||||
if (file_exists($indexFile)) {
|
|
||||||
$htmlFiles[] = $indexFile;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($htmlFiles)) {
|
|
||||||
foreach ($htmlFiles as $file) {
|
|
||||||
$fileName = basename($file);
|
|
||||||
$filePath = str_replace(__DIR__ . '/', '', $file);
|
|
||||||
|
|
||||||
// 读取文件内容
|
|
||||||
$content = file_get_contents($file);
|
|
||||||
|
|
||||||
// 提取title标签内容
|
|
||||||
preg_match('/<title>(.*?)<\/title>/i', $content, $matches);
|
|
||||||
$title = !empty($matches[1]) ? $matches[1] : $fileName;
|
|
||||||
|
|
||||||
// 输出链接
|
|
||||||
echo '<a href="' . $filePath . '" target="_blank"
|
|
||||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
|
||||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
|
||||||
<span>' . htmlspecialchars($title) . '</span>
|
|
||||||
</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
echo '<div class="p-3 border border-gray-200 rounded-lg text-gray-500">
|
|
||||||
<i class="fa-solid fa-info-circle mr-2"></i>暂无研究报告
|
|
||||||
</div>';
|
|
||||||
}
|
}
|
||||||
?>
|
}
|
||||||
</div>
|
rsort($dateDirs);
|
||||||
|
if (empty($dateDirs)): ?>
|
||||||
</div>
|
<div class="p-4 border border-gray-200 rounded-lg text-gray-500 text-center">
|
||||||
|
<i class="fa-solid fa-inbox mr-2"></i>暂无日期归档的研究报告
|
||||||
<div class="bg-white rounded-xl shadow-md p-6 card-hover">
|
|
||||||
<div class="flex items-center mb-6">
|
|
||||||
<div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
|
|
||||||
<i class="fa-solid fa-file-text text-indigo-600"></i>
|
|
||||||
</div>
|
</div>
|
||||||
<h3 class="text-lg font-semibold">PDF报告</h3>
|
<?php else: ?>
|
||||||
</div>
|
<div class="mb-4">
|
||||||
|
<select id="reportDate" name="reportDate"
|
||||||
<div class="mb-4 text-gray-600">
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50"
|
||||||
<p>以下是最新的市场研究报告,点击可查看详情。</p>
|
onchange="showReportGroup(this.value)">
|
||||||
</div>
|
<option value="">-- 选择日期 --</option>
|
||||||
|
<?php foreach ($dateDirs as $d): ?>
|
||||||
<div class="space-y-3">
|
<option value="<?= $d ?>"><?= substr($d,0,4).'-'.substr($d,4,2).'-'.substr($d,6,2) ?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
<a href="/research/ai_industry_report_kimi.pdf" target="_blank"
|
</select>
|
||||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
</div>
|
||||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
<?php foreach ($dateDirs as $d):
|
||||||
<span>中国AI产业链深度研究报告</span>
|
$htmls = glob("$researchDir/$d/*.html");
|
||||||
</a>
|
if (empty($htmls)) continue;
|
||||||
<a href="/research/ai_supply_chain_companys.pdf" target="_blank"
|
?>
|
||||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
<div class="report-group" id="report-<?= $d ?>" style="display:none;">
|
||||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
<div class="text-xs text-gray-400 mb-2 font-medium"><?= substr($d,0,4).'-'.substr($d,4,2).'-'.substr($d,6,2) ?></div>
|
||||||
<span>AI产业链上市公司护城河深度分析</span>
|
<div class="space-y-2">
|
||||||
</a>
|
<?php foreach ($htmls as $f):
|
||||||
<a href="/research/rongbai_vs_dangsheng.pdf" target="_blank"
|
$content = file_get_contents($f);
|
||||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
preg_match('/<title>(.*?)<\/title>/i', $content, $m);
|
||||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
$title = !empty($m[1]) ? $m[1] : basename($f);
|
||||||
<span>容百科技VS当升科技-三季报(豆包)</span>
|
$relPath = ltrim(str_replace(__DIR__, '', $f), '/');
|
||||||
</a>
|
?>
|
||||||
<a href="/research/rongbai_vs_dangsheng_qwen.pdf" target="_blank"
|
<a href="/<?= $relPath ?>" target="_blank"
|
||||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
class="flex items-center p-2 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all text-sm">
|
||||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
<i class="fa-solid fa-file-lines text-indigo-500 w-5 mr-2"></i>
|
||||||
<span>容百科技与当升科技 2025 年三季报投资价值深度对比分析(千问)</span>
|
<span><?= htmlspecialchars($title) ?></span>
|
||||||
</a>
|
</a>
|
||||||
<a href="/research/li_ore_2501_2511.pdf" target="_blank"
|
<?php endforeach; ?>
|
||||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
</div>
|
||||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
</div>
|
||||||
<span>2025 年 1-11 月全球锂电行业供求关系深度研究报告(豆包)</span>
|
<?php endforeach; ?>
|
||||||
</a>
|
<?php endif; ?>
|
||||||
<a href="/research/歌尔股份经营与AR行业分析.pdf" target="_blank"
|
|
||||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
|
||||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
|
||||||
<span>歌尔股份经营与AR行业分析(千问)</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
@@ -330,6 +285,14 @@
|
|||||||
window.open(url);
|
window.open(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showReportGroup(date) {
|
||||||
|
document.querySelectorAll('.report-group').forEach(el => el.style.display = 'none');
|
||||||
|
if (date) {
|
||||||
|
const target = document.getElementById('report-' + date);
|
||||||
|
if (target) target.style.display = 'block';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 股票搜索功能
|
// 股票搜索功能
|
||||||
document.getElementById('search-stock').addEventListener('click', function() {
|
document.getElementById('search-stock').addEventListener('click', function() {
|
||||||
const stockCode = document.getElementById('ts_code').value.trim();
|
const stockCode = document.getElementById('ts_code').value.trim();
|
||||||
|
|||||||
Reference in New Issue
Block a user