更新:添加每日和每月数据选项,修改相关URL参数,更新JavaScript文件,增加股票指数历史数据获取功能

This commit is contained in:
杨水淼
2025-07-09 07:36:50 +08:00
parent 5d135b24f1
commit 43a202c789
12 changed files with 734 additions and 53 deletions
+111 -8
View File
@@ -94,8 +94,8 @@ if($_REQUEST['t']=='esfListDaily'){
}
function esfTradeDaily(){
global $mysqli;
$sql= <<<EOF
if($_REQUEST['dm']=='Daily'){
$sql= <<<EOF
SELECT
distinct(ej.uuid) uid ,
date_format(tdate,'%Y-%m-%d') td,
@@ -110,7 +110,33 @@ function esfTradeDaily(){
where ej.data_type='5' and (ej.tdate>='{$_REQUEST['t_start']}' and ej.tdate<='{$_REQUEST['t_end']}')
order by ej.tdate asc
EOF;
}
if($_REQUEST['dm']=='Monthly'){
$where="";
if($_REQUEST['t_start']) $where .=" and ej.tdate>='{$_REQUEST['t_start']}-01'";
if($_REQUEST['t_end']) {
$endDate = new DateTime($_REQUEST['t_end']);
$endDate->modify('last day of this month');
$where .=" and ej.tdate<='{$endDate->format('Y-m-d')}'";
}
$sql= <<<EOF
SELECT
distinct(ej.uuid) uid ,
date_format(tdate,'%Y-%m') td,
eje.val district,
sum(eje1.val) qty,
sum(eje2.val) area
FROM
`estate_json` ej
left join estate_json_ext eje on ej.uuid=eje.uuid and eje.val='{$_REQUEST['district']}'
left join estate_json_ext eje1 on eje1.id=eje.id+3
left join estate_json_ext eje2 on eje2.id=eje.id+4
where ej.data_type='5' {$where}
group by date_format(tdate,'%Y-%m') order by date_format(tdate,'%Y-%m') asc
EOF;
//echo $sql;
}
$result = $mysqli->query($sql);
$data = $result->fetch_all(MYSQLI_ASSOC);
return $data;
@@ -118,8 +144,8 @@ EOF;
function esfListDaily(){
global $mysqli;
$sql= <<<EOF
if($_REQUEST['dm']=='Daily'){
$sql= <<<EOF
SELECT
distinct(ej.uuid) uid ,
date_format(tdate,'%Y-%m-%d') td,
@@ -134,7 +160,32 @@ function esfListDaily(){
where ej.data_type='8' and (ej.tdate>='{$_REQUEST['t_start']}' and ej.tdate<='{$_REQUEST['t_end']}')
order by ej.tdate asc
EOF;
}
if($_REQUEST['dm']=='Monthly'){
$where="";
if($_REQUEST['t_start']) $where .=" and ej.tdate>='{$_REQUEST['t_start']}-01'";
if($_REQUEST['t_end']) {
$endDate = new DateTime($_REQUEST['t_end']);
$endDate->modify('last day of this month');
$where .=" and ej.tdate<='{$endDate->format('Y-m-d')}'";
}
$sql= <<<EOF
SELECT
distinct(ej.uuid) uid ,
date_format(tdate,'%Y-%m') td,
eje.val district,
sum(eje1.val) qty,
sum(eje2.val) price
FROM
`estate_json` ej
left join estate_json_ext eje on ej.uuid=eje.uuid and eje.val='{$_REQUEST['district']}'
left join estate_json_ext eje1 on eje1.id=eje.id+3
left join estate_json_ext eje2 on eje2.id=eje.id+5
where ej.data_type='8' {$where}
group by date_format(tdate,'%Y-%m') order by date_format(tdate,'%Y-%m') asc
EOF;
//echo $sql;
}
$result = $mysqli->query($sql);
$data = $result->fetch_all(MYSQLI_ASSOC);
return $data;
@@ -144,7 +195,7 @@ EOF;
*newTBD: 新房Trade By Day
*/
if($_REQUEST['t']=='newTBD'){
if($_REQUEST['dm']=='Daily'){
$sql= <<<EOF
SELECT
distinct(ej.uuid) uid ,
@@ -158,11 +209,37 @@ if($_REQUEST['t']=='newTBD'){
left join estate_json_ext eje1 on eje1.id=eje.id+3
left join estate_json_ext eje2 on eje2.id=eje.id+4
where ej.data_type='1' and (ej.tdate>='{$_REQUEST['t_start']}' and ej.tdate<='{$_REQUEST['t_end']}')
order by date_format(tdate,'%Y-%m-%d') asc
EOF;
}
if($_REQUEST['dm']=='Monthly'){
$where="";
if($_REQUEST['t_start']) $where .=" and ej.tdate>='{$_REQUEST['t_start']}-01'";
if($_REQUEST['t_end']) {
$endDate = new DateTime($_REQUEST['t_end']);
$endDate->modify('last day of this month');
$where .=" and ej.tdate<='{$endDate->format('Y-m-d')}'";
}
$sql= <<<EOF
SELECT
distinct(ej.uuid) uid ,
date_format(tdate,'%Y-%m') td,
eje.val district,
sum(eje1.val) qty,
sum(eje2.val) area
FROM
`estate_json` ej
left join estate_json_ext eje on ej.uuid=eje.uuid and eje.val='{$_REQUEST['district']}'
left join estate_json_ext eje1 on eje1.id=eje.id+3
left join estate_json_ext eje2 on eje2.id=eje.id+4
where ej.data_type='1' {$where}
group by date_format(tdate,'%Y-%m') order by date_format(tdate,'%Y-%m') asc
EOF;
}
$result = $mysqli->query($sql);
$data = $result->fetch_all(MYSQLI_ASSOC);
if($_REQUEST['dm']=='Daily'){
$sql= <<<EOF
SELECT
distinct(ej.uuid) uid ,
@@ -176,7 +253,33 @@ EOF;
left join estate_json_ext eje1 on eje1.id=eje.id+3
left join estate_json_ext eje2 on eje2.id=eje.id+4
where ej.data_type='4' and (ej.tdate>='{$_REQUEST['t_start']}' and ej.tdate<='{$_REQUEST['t_end']}')
order by date_format(tdate,'%Y-%m-%d') asc
EOF;
}
if($_REQUEST['dm']=='Monthly'){
$where="";
if($_REQUEST['t_start']) $where .=" and ej.tdate>='{$_REQUEST['t_start']}-01'";
if($_REQUEST['t_end']) {
$endDate = new DateTime($_REQUEST['t_end']);
$endDate->modify('last day of this month');
$where .=" and ej.tdate<='{$endDate->format('Y-m-d')}'";
}
$sql= <<<EOF
SELECT
distinct(ej.uuid) uid ,
date_format(tdate,'%Y-%m-%d') td,
eje.val district,
max(eje1.val) area,
max(eje2.val) qty
FROM
`estate_json` ej
left join estate_json_ext eje on ej.uuid=eje.uuid and eje.val='{$_REQUEST['district']}'
left join estate_json_ext eje1 on eje1.id=eje.id+3
left join estate_json_ext eje2 on eje2.id=eje.id+4
where ej.data_type='4' $where
group by date_format(tdate,'%Y-%m') order by date_format(tdate,'%Y-%m') asc
EOF;
}
$result = $mysqli->query($sql);
$data2 = $result->fetch_all(MYSQLI_ASSOC);
echo json_encode(array(