Files
echart/inc/getEstate.inc.php
simonandClaude Opus 4.7 eedead0d41 feat: 全面代码更新 - ECharts 5.4.2 重构、新增量化分析模块、前端库升级
- 升级 ECharts 到 5.4.2,重构 lib/ 目录结构
- 新增 DataTables 2.x 和 FixedColumns 插件
- 新增 quant/ 宏观研究报告模块
- 重构图表页面:stock_trend、hkholdbycode 等采用 JS fetch API.doorcome.cn 模式
- 新增 CLAUDE.md 补充页面文档和新数据流说明
- 更新 inc/config.php TuShare API 配置
- 更新新闻联播分析模块 news/ 和相关研究报告 research/
- 新增 api_document/ 参考文档
- 清理 .gitignore,排除 uploads/xls/.mcp.json/ source maps 等非代码文件
- 所有 PHP 文件通过 php -l 语法检查

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-06 18:01:55 +08:00

96 lines
4.1 KiB
PHP

<?php
include_once __DIR__."/config.php";
function getEstateData($city, $fDate, $toDate){
$mysqli = get_mysqli_connection();
$sql = "SELECT city, listdate, sum(nums) as num FROM estate_listing where listdate >= ? and listdate <= ? and city = ? group by listdate";
$result = db_query($mysqli, $sql, [$fDate, $toDate, $city]);
$data=array();
if($result && $result->num_rows>0) {
while($row = $result->fetch_assoc()){
array_push($data,array("value"=>array($row['listdate'],$row['num'])));
}
}
return $data;
}
function esfTradeDaily(){
global $mysqli;
$district = $_REQUEST['district'];
$t_start = $_REQUEST['t_start'];
$t_end = $_REQUEST['t_end'];
if($_REQUEST['dm']=='Daily'){
$sql = "SELECT distinct(ej.uuid) uid, date_format(tdate,'%Y-%m-%d') td, eje.val district, eje1.val qty, eje2.val area
FROM estate_json ej
left join estate_json_ext eje on ej.uuid=eje.uuid and eje.val = ?
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' and ej.tdate >= ? and ej.tdate <= ?
order by ej.tdate asc";
$params = [$district, $t_start, $t_end];
}
if($_REQUEST['dm']=='Monthly'){
$sql = "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 = ?
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'";
$params = [$district];
if($t_start) {
$sql .= " and ej.tdate >= ?";
$params[] = $t_start . '-01';
}
if($t_end) {
$endDate = new DateTime($t_end);
$endDate->modify('last day of this month');
$sql .= " and ej.tdate <= ?";
$params[] = $endDate->format('Y-m-d');
}
$sql .= " group by date_format(tdate,'%Y-%m') order by date_format(tdate,'%Y-%m') asc";
}
$result = db_query($mysqli, $sql, $params);
$data = $result->fetch_all(MYSQLI_ASSOC);
return $data;
}
function esfListDaily(){
global $mysqli;
$district = $_REQUEST['district'];
$t_start = $_REQUEST['t_start'];
$t_end = $_REQUEST['t_end'];
if($_REQUEST['dm']=='Daily'){
$sql = "SELECT distinct(ej.uuid) uid, date_format(tdate,'%Y-%m-%d') td, eje.val district, eje1.val qty, eje2.val price
FROM estate_json ej
left join estate_json_ext eje on ej.uuid=eje.uuid and eje.val = ?
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' and ej.tdate >= ? and ej.tdate <= ?
order by ej.tdate asc";
$params = [$district, $t_start, $t_end];
}
if($_REQUEST['dm']=='Monthly'){
$sql = "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 = ?
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'";
$params = [$district];
if($t_start) {
$sql .= " and ej.tdate >= ?";
$params[] = $t_start . '-01';
}
if($t_end) {
$endDate = new DateTime($t_end);
$endDate->modify('last day of this month');
$sql .= " and ej.tdate <= ?";
$params[] = $endDate->format('Y-m-d');
}
$sql .= " group by date_format(tdate,'%Y-%m') order by date_format(tdate,'%Y-%m') asc";
}
$result = db_query($mysqli, $sql, $params);
$data = $result->fetch_all(MYSQLI_ASSOC);
return $data;
}
?>