更新:重构股票和指数趋势页面,增加流通市值图表,优化数据获取逻辑,修复代码中的小错误

This commit is contained in:
杨水淼
2025-07-10 17:24:15 +08:00
parent 5152b3ee2f
commit daeae185dd
4 changed files with 158 additions and 27 deletions
+10 -6
View File
@@ -1,9 +1,7 @@
<?php
include_once "inc/getBasic.inc.php";
$_REQUEST['ts_code']=$_REQUEST['ts_code']?$_REQUEST['ts_code']:'000001';
$_REQUEST['t_start']=$_REQUEST['t_start']?$_REQUEST['t_start']:'2015-01-01';
$_REQUEST['t_end']=$_REQUEST['t_end']?$_REQUEST['t_end']:'';
$ts_name = tscodeToName(ts_code_conv($_REQUEST['ts_code']));
$title="股价VS PE/PB/PS 趋势:".$ts_name.'('.$_REQUEST['ts_code'].')';
include_once "html/head.php";
?>
@@ -33,14 +31,20 @@ include_once "html/head.php";
let t_start = $('#t_start').val();
let t_end = $('#t_end').val();
let ts_code = $("#ts_code").val();
let codeName ="<?=$ts_name?>";
url = "https://api.doorcome.cn/api/stockparam/?tscode="+ts_code;
url += "&start_date="+t_start+"&end_date="+t_end;
fetch(url)
.then(httpresponse => httpresponse.json())
.then(parsedData => {
url2 = "https://api.doorcome.cn/api/stockinfo/?tscode="+ts_code;
Promise.all([
fetch(url),
fetch(url2)
])
.then(responses => Promise.all(responses.map(r => r.json())))
//.then(httpresponse => httpresponse.json())
//.then(parsedData => {
.then(([parsedData,stockInfo]) => {
// 图表配置:pe_ttm
let codeName = stockInfo[0].name;
var params = {};
params.chartid='pe_ttm';
params.legend = [codeName,'pe_ttm'];