refactor: 全面代码重构与项目结构整理

安全性:
- 所有SQL查询改用参数化查询(db_query),防止SQL注入
- TUSHARE_API_TOKEN集中到config.php常量,移除硬编码和多份拷贝
- getBasic.inc.php中$_REQUEST输出到JS时添加htmlspecialchars转义

代码组织:
- 21个页面文件移至charts/子目录,根目录仅保留入口文件
- ajax.inc.php拆分:esfTradeDaily/esfListDaily迁至getEstate.inc.php
- getBasic.inc.php拆分:HTML组件函数迁至新建的widgets.inc.php
- 前端依赖去重:移除lib/echarts.min.js、libai/3.4.16.js、research/js/3.4.16.js

规范化:
- AJAX响应格式统一为jsonResponse()标准封装
- 前端全局变量统一为window.chartConfig对象模式
- 修复PHP 8.4 Deprecated警告(getEstateData、getStockHistoryDataByTS参数顺序)
- html/head.php中jQuery/CSS路径改为绝对路径,修复charts/子目录加载问题

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
2026-05-26 08:20:33 +08:00
co-authored by Claude Code
parent 07da6a2ad4
commit 7e57cae242
49 changed files with 848 additions and 733 deletions
+84
View File
@@ -0,0 +1,84 @@
# AGENTS.md
本文件为 AI 编码助手提供在本仓库中工作的指引与约定。
## 项目背景
这是一个 A 股基本面数据可视化和宁波房地产数据分析平台,面向个人投资者使用。项目没有框架,是原生 PHP 写的传统 Web 应用。
## 技术约束
- **不要引入框架或构建工具** —— 项目是纯 PHP + jQuery + ECharts,没有 webpack、vite、composer autoload 之外的依赖管理。新增功能沿用现有模式即可。
- **不要动 `inc/config.php`** —— 该文件包含数据库连接逻辑且部分编码加密,手工修改可能破坏现有功能。
- **PHP 版本** —— 代码兼容 PHP 7.x/8.x,使用了 `mysqli`、cURL、Composer autoload。不要使用 PHP 8.1+ 独有的特性(如枚举、readonly 等)。
- **所有用户输入走 `$_REQUEST`** —— GET 和 POST 统一处理,不需要区分。
- **图表数据传递模式** —— 后端 PHP 查库 → `json_encode()` 注入 `<script>` 标签作为 JS 全局变量 → 页面专属的 JS 文件读取全局变量并用 `echarts.init()` 渲染。
## 代码风格约定
- 缩进:使用 Tab 缩进(现有代码风格)。
- SQL 查询:使用 heredoc 语法,保持可读性。
- PHP 标签:使用 `<?=``<?php` 短标签。
- 注释:中文注释,简洁为主,解释业务逻辑而非代码本身(如指数的 ts_code 映射、机构类型 LX 含义等)。
- 不需要加 docblock —— 现有代码基本没有,新代码也不加。
## 新增页面流程
如果要新增一个数据可视化页面,按以下步骤:
1.`inc/` 中写数据获取函数(如果数据源有复用价值),或在页面内直接写查询
2. 在根目录创建 `newpage.php`include 需要的 `inc/*.php`
3. 通过 `$_REQUEST` 接收参数(如 `ts_code``t_start``t_end`
4. 查询数据库,`json_encode` 结果注入到页面
5.`js/` 中创建对应的 JS 文件,负责 ECharts 初始化和图表渲染
6. 对于样式较新的页面,使用 `js/tailwindcss_3.4.17.js` 并参考 `index-2.php` 的布局风格
7.`index-2.php` 中添加导航入口
## 常用代码片段
### 获取数据库连接
```php
include_once __DIR__."/inc/config.php";
$mysqli = get_mysqli_connection();
```
### 标准查询返回 echarts 数据格式
```php
$tDate = $idx = $data = array();
while ($row = $result->fetch_assoc()) {
array_push($tDate, $row['trade_date']);
array_push($idx, $row['close']);
array_push($data, array("value" => array($row['trade_date'], round($row['close'], 2))));
}
$result->free();
$mysqli->close();
return array('tDate' => $tDate, 'idx' => $idx, 'data' => $data);
```
### 调用 TuShare API
```php
include_once __DIR__."/inc/functions.inc.php";
$data = callTushareApi('daily_basic', $params);
```
### 前端 AJAX 调用模式
```php
// 请求参数中必须包含 t 字段,用于路由
$_REQUEST['t'] = 'stockList'; // ajax.inc.php 中的 case
```
## 注意事项
- **TuShare API token 硬编码在代码中** —— 不要提交到公开仓库。
- **没有鉴权机制** —— 这是内网或个人使用的系统,不需要添加登录/权限功能。
- **数据库表名约定** —— 指数数据在 `index_hist_pro`,个股历史在 `stock_his_pro`,基本面在 `stock_his_basic_pro`,机构持仓在 `ih_by_ts_code_ext`,房地产数据在 `estate_json` 系列,交易记录在 `trade_record`
- **`deprecated/` 目录** —— 存放已废弃的旧版页面,直接忽略,不要修改或引用。
- **`news/``research/`** —— 独立的子模块,有自己的 JS/CSS 和设计文档,修改前先看对应的 `design.md``outline.md`
## Checkpoint
当用户说 "checkpoint" 时,在项目根目录生成 `continuation.md`,包含:
- **当前状态**:刚刚完成了什么、改了哪些文件、结果如何
- **后续步骤**:具体的、有序的下一步行动
- **待解决问题**:未解决的疑问、已知限制或需要决策的事项
+141
View File
@@ -0,0 +1,141 @@
# CLAUDE.md
本文件为 Claude Codeclaude.ai/code)在本仓库中工作提供指引。
## 项目概览
基于 PHP 的 A 股金融数据可视化和宁波房地产数据分析平台。使用 ECharts 生成交互式图表,后端为 MySQL 数据库和 TuShare API。
## 技术栈
- **后端**: PHP(无框架),Composer 管理依赖(`phpoffice/phpspreadsheet``monolog/monolog`
- **前端**: ECharts 4.x、jQuery、Tailwind CSS 3.4CDN 引入)、DataTables、Font Awesome
- **数据库**: MySQL,通过 `mysqli` 连接——统一使用 `inc/config.php` 中的 `get_mysqli_connection()` 获取连接
- **外部 API**: TuShare`api.tushare.pro``api.waditu.com`),用于获取财务数据
- **调试**: XDebug,端口 9000(配置见 `.vscode/launch.json`
## 无构建步骤
传统 PHP 应用,没有构建/检查/测试流水线。文件直接部署到 Web 服务器。运行于 `echart.doorcome.cn`。每个 `.php` 文件是独立的入口点,没有路由机制。
## 架构
### 核心 includes`inc/`
- `config.php` — 数据库连接工厂(`get_mysqli_connection()`),所有 DB 操作统一走此函数。另含 `db_query()` 参数化查询函数和 `jsonResponse()` 统一 JSON 响应函数。
- `getData.inc.php` — 指数数据、机构持仓(IH)、资金流向(沪深港通南北向)、个股历史查询。
- `getBasic.inc.php` — PE/PB/PS 历史、股价历史、市值数据、TuShare API 封装、日期工具、数据查询函数。HTML 渲染函数已拆分至 `widgets.inc.php`
- `widgets.inc.php` — HTML 组件函数:`tradeStocksList()``vendorList()``yearList()``yearToname()`
- `functions.inc.php` — 共享表单组件(districtList、indexList、seList、byDM)和 `callTushareApi()` 辅助函数。
- `ajax.inc.php` — 所有 AJAX 端点,通过 `$_REQUEST['t']` 分发:股票列表、财务数据(调用 `getFinanceData.class.php`)、房地产成交/挂牌查询。业务函数(`esfTradeDaily``esfListDaily`)已迁移至 `getEstate.inc.php`
- `getFinanceData.class.php``getFinance` 类,调用 TuShare API 获取财务报表数据。
- `tradeRec.inc.php` — 交易记录查询(`trade_record` / `trade_record_cj` 表)。
- `excelOperate.inc.php` — 通过 PhpSpreadsheet 读取 Excel/CSV 文件。
- `postJson.inc.php` — 使用 cURL 发送 JSON HTTP POST 请求。
- `getEstate.inc.php` — 房地产相关数据查询(`estate_listing` 表)及二手房成交/挂牌数据函数。
### 页面结构
根目录及 `charts/` 下的每个 `.php` 文件渲染一个独立的数据视图,遵循统一模式:
1. 引入所需的 `inc/*.php`
2. 通过 `$_REQUEST` 接收查询参数
3. 查询数据库,将结果通过 `json_encode()` 注入 `<script>` 标签
4. 加载对应的 `js/*.js`,由 JS 调用 `echarts.init()` 渲染图表
5. 引入 `html/head.php``html/footer.php` 组成页面布局
### 页面目录
根目录保留入口文件(`index.php``index-2.php``phpinfo.php`),其余页面文件均位于 `charts/` 子目录。
| 文件 | 用途 |
|------|------|
| `index.php` | 原导航页,重定向至 `index-2.php` |
| `index-2.php` | 主导航门户(Tailwind 风格) |
| `charts/stock_trend.php` | 股价 VS PE/PB/PS 趋势 |
| `charts/stockep.php` | 股价 VS 盈利能力 |
| `charts/stockdiv.php` | 股价 VS 股息率 |
| `charts/stockmargin.php` | 股价 VS 融资融券余额 |
| `charts/hkholdbycode.php` | 股价 VS 北向资金持股 |
| `charts/stock_ih.php` | 股价 VS 机构持仓趋势 |
| `charts/stockkeydata.php` | 个股基本面数据 |
| `charts/index_trend.php` | 指数 VS PE/PB/PS/市值 |
| `charts/index_ih.php` | 指数 VS 机构持仓趋势 |
| `charts/index_mv_all.php` | 指数 VS 两市总市值 |
| `charts/index_margin.php` | 指数 VS 融资余额 |
| `charts/moneyflow.php` | 指数 VS 沪深港通资金流向 |
| `charts/realestate.php` | 房地产挂牌数量趋势(宁波) |
| `charts/estateNewTradeDaily.php` | 新房每日成交量(宁波) |
| `charts/estateTradeDaily.php` | 二手房每日成交量(宁波) |
| `charts/estateListDaily.php` | 二手房每日挂牌量(宁波) |
| `charts/stockTradeRecord.php` | 个人股票交易记录 |
| `charts/chartStDetail.php` | 个股详细图表 |
### JavaScript 约定
每个页面加载 `js/` 中对应的 JS 文件(如 `chartStDetail.js``renderCharts.js``estate.js`)。新版页面通过 `window.chartConfig` 对象传递数据,旧版页面正逐步迁移至此模式。ECharts 库统一使用 `lib/echarts/5.4.2/echarts.js`v5)。
### 子模块
- `news/` — 独立的新闻抓取/分析模块,面向 CCTV 新闻联播。包含自己的 PHP、JS 和设计文档。
- `research/` — 股票研究报告(HTML 和 PDF)、行业分析,含 AI 生成的研究内容。
- `deprecated/` — 已废弃的旧版页面和脚本,仅供参考。
### 前端库位置
- `lib/` — jQuery、DataTables、ECharts 5.4.2
- `libai/` — Chart.js、anime.js、shader-park-coreAI/研究页面使用)
- `js/` — 页面专属图表逻辑、Tailwind CSS 3.4.17、ECharts GL、ecStat
- `css/` — 自定义样式(`style.css``css2.css`)、Font Awesome
## 服务器与部署
应用运行于 `echart.doorcome.cn`。所有用户输入通过 `$_REQUEST` 读取——GET 和 POST 统一处理。无认证或 CSRF 防护。数据库凭据在 `inc/config.php` 中。
TuShare API Token 统一定义在 `inc/config.php``TUSHARE_API_TOKEN` 常量中。
部署到远程服务器使用 `sync-echart` 命令(定义在 `~/.bashrc` 中),自动排除 `.git``.vscode``.claude``.files`
```bash
sync-echart -n # 先预览
sync-echart # 执行部署
```
服务器路径:`simon@www.doorcome.cn:/var/www/html/echart/`
## 多文件修改规范
修改多个文件前,先输出:
- **涉及文件** — 列出所有将被修改的文件
- **修改原因** — 每个文件为什么需要改
- **潜在影响** — 可能破坏什么,哪些消费者会受影响
修改完成后,输出:
- **已完成列表** — 每个文件的具体变更内容
- **验证步骤** — 确认正确性的步骤(语法检查、页面访问测试等)
## 风险意识
- 本项目**没有自动化测试**,所有变更需手动验证。
- 跨层修改(如 AJAX 响应格式、JS 全局变量、PHP 引入路径)属于**高风险操作**——修改前必须追踪所有消费者,并明确说明风险后再动手。
- 修改 AJAX 响应格式时,需同时检查 PHP 端消费者(服务端数据组装)和 JS 端消费者(`$.ajax` success 回调、`getRows()` 调用、DataTables 配置)。
- 修改 JS 全局变量名时,需检查所有引用这些变量的 `.js` 文件,而非仅检查注入变量的 PHP 页面。
- `deprecated/` 目录的文件可更新路径以保持一致性,除此之外不要改动。
## 批量脚本注意事项
用 Python/sed 对大量文件做机械性修改(路径前缀替换、变量重命名)可以接受,但需:
- 运行脚本前先列出将要影响的文件清单
- 脚本运行后,用 grep 搜索旧模式确认无遗漏
- 对每个修改过的 PHP 文件执行 `php -l` 语法检查
## Checkpoint
当用户说 "checkpoint" 时,在项目根目录生成 `continuation.md`,包含:
- **当前状态**:刚刚完成了什么、改了哪些文件、结果如何
- **后续步骤**:具体有序的下一步行动
- **待解决问题**:未解决的疑问、已知限制或需要决策的事项
+12 -10
View File
@@ -1,11 +1,11 @@
<?php
#查询个股价格对应机构持仓的数量
include_once "inc/getBasic.inc.php";
include_once "inc/getData.inc.php";
include_once "../inc/getBasic.inc.php";
include_once "../inc/getData.inc.php";
$ts_code=ts_code_conv($_REQUEST['ts_code']);
$ts_name = tscodeToName($ts_code);
include_once "html/headChart.php"; //required after $ts_code and $ts_name
include_once "../html/headChart.php"; //required after $ts_code and $ts_name
$day_st=($_REQUEST['s']=='')?'2012-01-01':$_REQUEST['s'];
$day_end=($_REQUEST['e']=='')?date('Y-m-d'):$_REQUEST['e'];
@@ -51,14 +51,16 @@ $legend=array('不复权股价','深证成指',$item_name);
?>
<script type="text/javascript">
var data1 = <?php echo json_encode($data['data']); ?>;
var data2 =<?php echo json_encode($data2['data']); ?>;
var legend = <?php echo json_encode($legend);?>;
var unit ='<?php echo $unit; ?>';
var headtxt = '<?php echo $ts_name.'('.$ts_code.')'; ?>';
var subtxt = '<?php echo $subtext_ext; ?>';
window.chartConfig = {
data: <?php echo json_encode($data['data']); ?>,
data2: <?php echo json_encode($data2['data']); ?>,
legend: <?php echo json_encode($legend);?>,
unit: '<?php echo $unit; ?>',
title: '<?php echo $ts_name.'('.$ts_code.')'; ?>',
subtitle: '<?php echo $subtext_ext; ?>'
};
</script>
<script type="text/javascript" src="js/chartSix.js?ver=3.141"></script>
<script type="text/javascript" src="../js/chartSix.js?ver=3.141"></script>
</body>
</html>
@@ -1,10 +1,10 @@
<?php
include_once "/inc/config.php";
include_once "../inc/config.php";
$mysqli = get_mysqli_connection();
include_once dirname(__FILE__) . "/inc/getBasic.inc.php";
include_once dirname(__FILE__) . "/inc/getData.inc.php";
include_once dirname(__FILE__) . "/inc/tradeRec.inc.php";
include_once __DIR__ . "/html/headChart.php";
include_once dirname(__FILE__) . "/../inc/getBasic.inc.php";
include_once dirname(__FILE__) . "/../inc/getData.inc.php";
include_once dirname(__FILE__) . "/../inc/tradeRec.inc.php";
include_once __DIR__ . "/../html/headChart.php";
$ts_code= ts_code_conv($_REQUEST['ts_code']);
$day_st = ($_REQUEST['s']=='')?'20180101':reformDate($_REQUEST['s']);
$day_end= ($_REQUEST['e']=='')?date('Ymd'):reformDate($_REQUEST['e']);
@@ -48,11 +48,11 @@ if($_REQUEST['adj']) $legend[0]='复权股价';
console.log(data1[0]['value'][0]);
console.log(data1[0]['value'][1]);
</script>
<script type="text/javascript" src="js/adj.ajax.js?verion=3.14"></script>
<script type="text/javascript" src="../js/adj.ajax.js?verion=3.14"></script>
<script>
console.log(data1[0]['value'][0]);
console.log(data1[0]['value'][1]);
</script>
<script type="text/javascript" src="js/chartStDetail.js?version=3.16"></script>
<script type="text/javascript" src="../js/chartStDetail.js?version=3.16"></script>
</body>
</html>
+11 -7
View File
@@ -1,6 +1,6 @@
<?php
include_once "inc/getData.inc.php";
include_once "html/headChart.php"; //required after $ts_code and $ts_name,maybe doesn't matter
include_once "../inc/getData.inc.php";
include_once "../html/headChart.php"; //required after $ts_code and $ts_name,maybe doesn't matter
$day_st=$_REQUEST['s']?$_REQUEST['s']:'2006-01-01';
$day_end=$_REQUEST['e']?$_REQUEST['e']:date('Y-m-d');
#$day_st_='2006-01-01';
@@ -23,11 +23,15 @@ var dom = document.getElementById("container");
var myChart = echarts.init(dom,'dark');
var app = {};
option = null;
legend = <?php echo json_encode($legend);?>;
unit ='<?php echo $unit; ?>';
window.chartConfig = {
legend: <?php echo json_encode($legend); ?>,
unit: '<?php echo $unit; ?>'
};
var cfg = window.chartConfig;
option = {
title: {
text: legend[0]+' V.S '+legend[2],
text: cfg.legend[0]+" V.S "+cfg.legend[2],
//subtext:"双轴显示",
textAlign:'center',
left:'50%'
@@ -36,7 +40,7 @@ option = {
trigger: 'axis'
},
legend: {
data:legend,
data: cfg.legend,
right:'20'
},
grid: {
@@ -62,7 +66,7 @@ option = {
},
{
type:'value',
name:legend[2]+unit, //图例
name: cfg.legend[2]+cfg.unit, //图例
//scale:true,
boundaryGap:false,
show:true,
@@ -1,5 +1,5 @@
<?php
require_once "inc/functions.inc.php";
require_once "../inc/functions.inc.php";
$_REQUEST['t_start']=$_REQUEST['t_start']?$_REQUEST['t_start']:'2023-08-15';
$_REQUEST['t_end']=$_REQUEST['t_end']?$_REQUEST['t_end']:date('Y-m-d');
$_REQUEST['district']=$_REQUEST['district']?$_REQUEST['district']:'合计';
@@ -11,7 +11,7 @@ $urlAppend = "t=esfListDaily&t_start={$_REQUEST['t_start']}&t_end={$_REQUEST['t
$urlAppend .= "&district={$_REQUEST['district']}";
$urlAppend .= "&dm=Daily";
$url = 'https://echart.doorcome.cn/inc/ajax.inc.php?'.$urlAppend;
include_once "html/head.php";
include_once "../html/head.php";
?>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
@@ -48,8 +48,8 @@ include_once "html/head.php";
dataType:'json',
success:function(data){
console.log(data)
data1 = getRows(data.datas,dataSel1);
data2 = getRows(data.datas,dataSel2);
data1 = getRows(data.data.datas,dataSel1);
data2 = getRows(data.data.datas,dataSel2);
console.log(data1);
console.log(data2);
var dom = document.getElementById("container");
@@ -147,5 +147,5 @@ include_once "html/head.php";
}
)
</script>
<?php include_once "html/footer.php"; ?>
<?php include_once "../html/footer.php"; ?>
@@ -1,5 +1,5 @@
<?php
require_once "inc/functions.inc.php";
require_once "../inc/functions.inc.php";
$_REQUEST['t_start']=$_REQUEST['t_start']?$_REQUEST['t_start']:'2023-08-15';
$_REQUEST['t_end']=$_REQUEST['t_end']?$_REQUEST['t_end']:date('Y-m-d');
$_REQUEST['mst']=$_REQUEST['mst']?$_REQUEST['mst']:'2023-08';
@@ -26,7 +26,7 @@ if($_REQUEST['dm']=='Monthly') $urlAppend2.="&t_start={$_REQUEST['mst']}&t_end={
$urlAppend2 .= "&district={$_REQUEST['district']}";
$urlAppend2 .= "&dm={$_REQUEST['dm']}";
$url2 = 'https://echart.doorcome.cn/inc/ajax.inc.php?'.$urlAppend2;
include_once "html/head.php";
include_once "../html/head.php";
?>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
@@ -86,9 +86,9 @@ Daily/Monthly:
dataType:'json',
success:function(data){
console.log(data)
data1 = getRows(data.datas,dataSel1); //成交面积
data2 = getRows(data.datas,dataSel2); //成交套数
data3 = getRows(data.dataExt,dataSel2); //存量套数
data1 = getRows(data.data.datas,dataSel1); //成交面积
data2 = getRows(data.data.datas,dataSel2); //成交套数
data3 = getRows(data.data.dataExt,dataSel2); //存量套数
//console.log(data1);
//console.log(data2);
var dom = document.getElementById("container");
@@ -209,8 +209,8 @@ Daily/Monthly:
dataType:'json',
success:function(data2){
console.log(data2)
data3 = getRows(data2.dataTrade,dataSel3);
data4 = getRows(data2.dataTrade,dataSel4);
data3 = getRows(data2.data.dataTrade,dataSel3);
data4 = getRows(data2.data.dataTrade,dataSel4);
//console.log(data3);
//console.log(data4);
var dom = document.getElementById("container2");
@@ -308,5 +308,5 @@ Daily/Monthly:
}
)
</script>
<?php include_once "html/footer.php"; ?>
<?php include_once "../html/footer.php"; ?>
@@ -7,7 +7,7 @@
* @Description:
* Copyright 2025 Yangshuimiao, All Rights Reserved.
*/
require_once "inc/functions.inc.php";
require_once "../inc/functions.inc.php";
$_REQUEST['t_start']=$_REQUEST['t_start']?$_REQUEST['t_start']:'2023-08-15';
$_REQUEST['t_end']=$_REQUEST['t_end']?$_REQUEST['t_end']:date('Y-m-d');
@@ -27,7 +27,7 @@ if($_REQUEST['dm']=='Monthly') $urlAppend.="&t_start={$_REQUEST['mst']}&t_end={$
$urlAppend .= "&district={$_REQUEST['district']}";
$urlAppend .= "&dm={$_REQUEST['dm']}";
$url = 'https://echart.doorcome.cn/inc/ajax.inc.php?'.$urlAppend;
include_once "html/head.php";
include_once "../html/head.php";
?>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
@@ -84,9 +84,9 @@ Daily/Monthly:
dataType:'json',
success:function(data){
console.log(data)
data1 = getRows(data.dataList,dataSel1);
data2 = getRows(data.dataTrade,dataSel2);
data3 = getRows(data.dataTrade,dataSel1);
data1 = getRows(data.data.dataList,dataSel1);
data2 = getRows(data.data.dataTrade,dataSel2);
data3 = getRows(data.data.dataTrade,dataSel1);
//console.log(data1);
//console.log(data2);
var dom = document.getElementById("container");
@@ -197,5 +197,5 @@ Daily/Monthly:
}
)
</script>
<?php include_once "html/footer.php"; ?>
<?php include_once "../html/footer.php"; ?>
+7 -7
View File
@@ -1,7 +1,7 @@
<?php
include_once "inc/getBasic.inc.php";
include_once "inc/getData.inc.php";
include_once "inc/postJson.inc.php";
include_once "../inc/getBasic.inc.php";
include_once "../inc/getData.inc.php";
include_once "../inc/postJson.inc.php";
$_REQUEST['ts_code']=$_REQUEST['ts_code']?$_REQUEST['ts_code']:'000001';
$_REQUEST['tp']=$_REQUEST['tp']?$_REQUEST['tp']:'ratio';
$_REQUEST['t_start']=$_REQUEST['t_start']?$_REQUEST['t_start']:'2015-06-01';
@@ -20,9 +20,9 @@ $subtext_ext .= ", Average: ".$data2['data_avg'];
$subtext_ext .= ", Recent: ".$data2['data_last'];
$legend=array('不复权股价',hkholdConv($_REQUEST['tp']));
include_once "html/head.php";
include_once "../html/head.php";
?>
<script src="js/renderCharts.js"></script>
<script src="../js/renderCharts.js"></script>
<form name="main" id="main" method="get">
<div style="width:100%;text-align:center">
股票代码: <input type='text' name='ts_code' id='ts_code' width="30px" value='<?=$_REQUEST['ts_code']?>' >
@@ -98,6 +98,6 @@ include_once "html/head.php";
);
}
</script>
<script type="text/javascript" src="js/hkhold.js?version=3.14"></script>
<?php include_once "html/footer.php"; ?>
<script type="text/javascript" src="../js/hkhold.js?version=3.14"></script>
<?php include_once "../html/footer.php"; ?>
+10 -10
View File
@@ -1,10 +1,10 @@
<?php
include_once "inc/getBasic.inc.php";
include_once "../inc/getBasic.inc.php";
$_REQUEST['code']=$_REQUEST['code']?$_REQUEST['code']:'ShareHDNum'; #code:sh sz zx cy
$_REQUEST['t_start']=$_REQUEST['t_start']?$_REQUEST['t_start']:'2006-01-01';
$_REQUEST['t_end']=$_REQUEST['t_end']?$_REQUEST['t_end']:'';
$title="指数VS机构持仓";
include_once "html/head.php";
include_once "../html/head.php";
?>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
指标代码:
@@ -28,35 +28,35 @@ include_once "html/head.php";
<input type='checkbox' id='cb_06' onclick="hideSwitch(this.id,'6')" > 信托
</div> </form>
<div >&nbsp;</div>
<!-- https://echart.doorcome.cn/chartThree.php?lx=1&share=vPosition&s=2010-01-01 -->
<!-- https://echart.doorcome.cn/charts/chartThree.php?lx=1&share=vPosition&s=2010-01-01 -->
<div style="width:100%; text-align:center;display:None" id='1'>
<iframe src="https://echart.doorcome.cn/chartThree.php?s=<?=$_REQUEST['t_start']?>&lx=1&share=<?=$_REQUEST['code']?>&e=<?=$_REQUEST['t_end']?>"
<iframe src="https://echart.doorcome.cn/charts/chartThree.php?s=<?=$_REQUEST['t_start']?>&lx=1&share=<?=$_REQUEST['code']?>&e=<?=$_REQUEST['t_end']?>
height="400px" width="1000px"></iframe>
<div >&nbsp;</div>
</div>
<div style="width:100%; text-align:center; display:block;" id='2'>
<iframe src="https://echart.doorcome.cn/chartThree.php?s=<?=$_REQUEST['t_start']?>&lx=2&share=<?=$_REQUEST['code']?>&e=<?=$_REQUEST['t_end']?>"
<iframe src="https://echart.doorcome.cn/charts/chartThree.php?s=<?=$_REQUEST['t_start']?>&lx=2&share=<?=$_REQUEST['code']?>&e=<?=$_REQUEST['t_end']?>
height="400px" width="1000px"></iframe>
<div >&nbsp;</div>
</div>
<div style="width:100%; text-align:center; display:None;" id='3'>
<iframe src="https://echart.doorcome.cn/chartThree.php?s=<?=$_REQUEST['t_start']?>&lx=3&share=<?=$_REQUEST['code']?>&e=<?=$_REQUEST['t_end']?>"
<iframe src="https://echart.doorcome.cn/charts/chartThree.php?s=<?=$_REQUEST['t_start']?>&lx=3&share=<?=$_REQUEST['code']?>&e=<?=$_REQUEST['t_end']?>
height="400px" width="1000px"></iframe>
</div>
<div >&nbsp;</div>
<div style="width:100%; text-align:center; display:None;" id='4'>
<iframe src="https://echart.doorcome.cn/chartThree.php?s=<?=$_REQUEST['t_start']?>&lx=4&share=<?=$_REQUEST['code']?>&e=<?=$_REQUEST['t_end']?>"
<iframe src="https://echart.doorcome.cn/charts/chartThree.php?s=<?=$_REQUEST['t_start']?>&lx=4&share=<?=$_REQUEST['code']?>&e=<?=$_REQUEST['t_end']?>
height="400px" width="1000px"></iframe>
</div>
<div >&nbsp;</div>
<div style="width:100%; text-align:center; display:None;" id='5'>
<iframe src="https://echart.doorcome.cn/chartThree.php?s=<?=$_REQUEST['t_start']?>&lx=5&share=<?=$_REQUEST['code']?>&e=<?=$_REQUEST['t_end']?>"
<iframe src="https://echart.doorcome.cn/charts/chartThree.php?s=<?=$_REQUEST['t_start']?>&lx=5&share=<?=$_REQUEST['code']?>&e=<?=$_REQUEST['t_end']?>
height="400px" width="1000px"></iframe>
</div>
<div >&nbsp;</div>
<div style="width:100%; text-align:center; display:None;" id='6'>
<iframe src="https://echart.doorcome.cn/chartThree.php?s=<?=$_REQUEST['t_start']?>&lx=6&share=<?=$_REQUEST['code']?>&e=<?=$_REQUEST['t_end']?>"
<iframe src="https://echart.doorcome.cn/charts/chartThree.php?s=<?=$_REQUEST['t_start']?>&lx=6&share=<?=$_REQUEST['code']?>&e=<?=$_REQUEST['t_end']?>
height="400px" width="1000px"></iframe>
</div>
<?php include_once "html/footer.php"; ?>
<?php include_once "../html/footer.php"; ?>
+4 -4
View File
@@ -1,13 +1,13 @@
<?php
include_once("inc/functions.inc.php");
include_once("../inc/functions.inc.php");
$_REQUEST['code']=$_REQUEST['code']?$_REQUEST['code']:'000001.SH';
$_REQUEST['se']=$_REQUEST['se']?$_REQUEST['se']:'SSE';
$_REQUEST['t_start']=$_REQUEST['t_start']?$_REQUEST['t_start']:'2020-01-01';
$_REQUEST['t_end']=$_REQUEST['t_end']?$_REQUEST['t_end']:date('Y-m-d');
$title="指数VS融资融券余额";
include_once "html/head.php";
include_once "../html/head.php";
?>
<script src="js/renderCharts.js"></script>
<script src="../js/renderCharts.js"></script>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
指数代码: <?php indexList('code'); ?>&nbsp;
融资融券交易所: <?php seList('se'); ?>&nbsp;
@@ -97,5 +97,5 @@ include_once "html/head.php";
});
}
</script>
<?php include_once("html/footer.php"); ?>
<?php include_once("../html/footer.php"); ?>
+4 -4
View File
@@ -1,12 +1,12 @@
<?php
include_once("inc/functions.inc.php");
include_once("../inc/functions.inc.php");
$_REQUEST['code']=$_REQUEST['code']?$_REQUEST['code']:'000001.SH';
$_REQUEST['t_start']=$_REQUEST['t_start']?$_REQUEST['t_start']:'2015-01-01';
$_REQUEST['t_end']=$_REQUEST['t_end']?$_REQUEST['t_end']:date('Y-m-d');
$title="指数VS两市总市值趋势";
include_once "html/head.php";
include_once "../html/head.php";
?>
<script src="js/renderCharts.js"></script>
<script src="../js/renderCharts.js"></script>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
指数代码: <?php indexList('code'); ?>
&nbsp;
@@ -151,5 +151,5 @@ function mergeAndSumArrays(arr1, arr2) {
return resultArray;
}
</script>
<?php include_once("html/footer.php"); ?>
<?php include_once("../html/footer.php"); ?>
+4 -4
View File
@@ -7,16 +7,16 @@
* @FilePath: \echarts\index_trend.php
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
include_once("inc/functions.inc.php");
include_once("../inc/functions.inc.php");
$title="指数VS PE/PB/PS/市值 趋势";
include_once "html/head.php";
include_once "../html/head.php";
$_REQUEST['code'] = $_REQUEST['code']?$_REQUEST['code']:'000001.SH';
$_REQUEST['t_start']= $_REQUEST['t_start']?$_REQUEST['t_start']:'2020-01-01';
$_REQUEST['t_end'] = $_REQUEST['t_end']?$_REQUEST['t_end']:date('Y-m-d');
$ts_code = $_REQUEST['code'];
?>
<script src="js/renderCharts.js"></script>
<script src="../js/renderCharts.js"></script>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
指数代码:
<?php indexList('code'); ?>&nbsp;
@@ -153,4 +153,4 @@ $ts_code = $_REQUEST['code'];
});
}
</script>
<?php include_once "html/footer.php"; ?>
<?php include_once "../html/footer.php"; ?>
+14 -12
View File
@@ -1,7 +1,7 @@
<?php
include_once "inc/getBasic.inc.php";
include_once "inc/getData.inc.php";
include_once "inc/postJson.inc.php";
include_once "../inc/getBasic.inc.php";
include_once "../inc/getData.inc.php";
include_once "../inc/postJson.inc.php";
$_REQUEST['code']=$_REQUEST['code']?$_REQUEST['code']:'sh';
$_REQUEST['hsgt']=$_REQUEST['hsgt']?$_REQUEST['hsgt']:'north_money';
$_REQUEST['stacked']=$_REQUEST['stacked']?$_REQUEST['stacked']:'1';
@@ -19,7 +19,7 @@ $subtext_ext .= ", Min: ".$data2['data_min'];
$subtext_ext .= ", Average: ".$data2['data_avg'];
$subtext_ext .= ", Recent: ".$data2['data_last'];
$legend=array(codeToName($_REQUEST['code']),hsgtConv($_REQUEST['hsgt']));
include_once "html/head.php";
include_once "../html/head.php";
?>
<form name="main" id="main" method="get">
<div style="width:100%;text-align:center">
@@ -58,13 +58,15 @@ include_once "html/head.php";
<div >&nbsp;</div>
<div id="container" style="margin:0 auto;height: 400px;width: 1000px"></div>
<script type="text/javascript">
var data1 = <?php echo json_encode($data['data']); ?>;
var data2 =<?php echo json_encode($data2['data']); ?>;
var legend = <?php echo json_encode($legend);?>;
var unit ='<?php echo $unit; ?>';
var headtxt = '<?php echo codeToName($_REQUEST['code']).'VS'.hsgtConv($_REQUEST['hsgt']); ?>';
var subtxt = '<?php echo $subtext_ext; ?>';
window.chartConfig = {
data: <?php echo json_encode($data['data']); ?>,
data2: <?php echo json_encode($data2['data']); ?>,
legend: <?php echo json_encode($legend);?>,
unit: '<?php echo $unit; ?>',
title: '<?php echo codeToName($_REQUEST['code']).'VS'.hsgtConv($_REQUEST['hsgt']); ?>',
subtitle: '<?php echo $subtext_ext; ?>'
};
</script>
<script type="text/javascript" src="js/chartmoneyflow.js?version=3.141"></script>
<?php include_once "html/footer.php"; ?>
<script type="text/javascript" src="../js/chartmoneyflow.js?version=3.141"></script>
<?php include_once "../html/footer.php"; ?>
+3 -3
View File
@@ -1,11 +1,11 @@
<?php
ini_set("display_errors","1");
include_once "/inc/config.php";
include_once "../inc/config.php";
//ini_set('error_reporting', 'E_ALL'); //wrong way to open error_reporting
//ini_set("error_reporting","32759"); //Right way to set error_reporting
$mysqli = get_mysqli_connection();
include_once __DIR__ . "/inc/excelOperate.inc.php";
include_once __DIR__ . "/inc/tradeRec.inc.php";
include_once __DIR__ . "/../inc/excelOperate.inc.php";
include_once __DIR__ . "/../inc/tradeRec.inc.php";
$file = $_REQUEST['fpath'];
$company = $_REQUEST['up_vendor'];
+12 -10
View File
@@ -1,8 +1,8 @@
<?php
include_once "inc/getBasic.inc.php";
include_once "inc/getData.inc.php";
include_once "inc/postJson.inc.php";
include_once "inc/getEstate.inc.php";
include_once "../inc/getBasic.inc.php";
include_once "../inc/getData.inc.php";
include_once "../inc/postJson.inc.php";
include_once "../inc/getEstate.inc.php";
$_REQUEST['t_start']=$_REQUEST['t_start']?$_REQUEST['t_start']:'2023-06-20';
$_REQUEST['t_end']=$_REQUEST['t_end']?$_REQUEST['t_end']:date('Y-m-d');
@@ -10,7 +10,7 @@ $title="房地产挂牌数量趋势(宁波)";
$data=getEstateData('宁波',$_REQUEST['t_start'],$_REQUEST['t_end']);
$legend=array('挂牌数(套)');
include_once "html/head.php";
include_once "../html/head.php";
?>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
@@ -28,10 +28,12 @@ include_once "html/head.php";
* 数据来源:<a href='https://www.cnnbfdc.com/' target='_blank'>宁波市房产交易服务信息网</a><br />
* 更新时间:每天上午9:00</span></div>
<script type="text/javascript">
var data1 = <?php echo json_encode($data); ?>;
var legend = <?php echo json_encode($legend);?>;
var headtxt = '<?php echo $title; ?>';
window.chartConfig = {
data: <?php echo json_encode($data); ?>,
legend: <?php echo json_encode($legend); ?>,
title: '<?php echo $title; ?>'
};
</script>
<script type="text/javascript" src="js/estate.js?version=3.24"></script>
<?php include_once "html/footer.php"; ?>
<script type="text/javascript" src="../js/estate.js?version=3.24"></script>
<?php include_once "../html/footer.php"; ?>
@@ -1,9 +1,9 @@
<?php
ini_set("display_errors","0");
include_once "/inc/config.php";
include_once dirname(__FILE__) . "/inc/getBasic.inc.php";
include_once dirname(__FILE__) . "/inc/tradeRec.inc.php";
include_once __DIR__ . "/inc/postJson.inc.php";
include_once "../inc/config.php";
include_once dirname(__FILE__) . "/../inc/getBasic.inc.php";
include_once dirname(__FILE__) . "/../inc/tradeRec.inc.php";
include_once __DIR__ . "/../inc/postJson.inc.php";
//include_once dirname(__FILE__) . "/class/basic_info.class.php";
$mysqli = get_mysqli_connection();
$_REQUEST['t_vendor']=($_REQUEST['t_vendor'])?$_REQUEST['t_vendor']:'方正证券';
@@ -41,7 +41,7 @@ if($_REQUEST['ts_code']) {
}
$title="个股交易记录:".$ts_name.'('.$_REQUEST['ts_code'].')';
include_once "html/head.php";
include_once "../html/head.php";
?>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
@@ -74,7 +74,7 @@ if($_REQUEST['ts_code'] and $trdData) {
$i++;
if(fmod($i,5)==0) print("<br />\n");
}
$url="https://echart.doorcome.cn/chartStDetail.php?";
$url="https://echart.doorcome.cn/charts/chartStDetail.php?";
$url.="ts_code={$_REQUEST['ts_code']}";
$url.="&s={$_REQUEST['t_start']}&e={$_REQUEST['t_end']}";
$url.="&t_vendor={$_REQUEST['t_vendor']}";
@@ -82,7 +82,7 @@ if($_REQUEST['ts_code'] and $trdData) {
echo <<<EOF
</div>
<div style="width:100%; text-align:center;margin:0 auto;">
<iframe src="{$url}"
<iframe src="{$url}
height="400px" width="1000px"></iframe>
</div>
EOF;
@@ -159,7 +159,7 @@ EOF;
var formData = new FormData($('#form1')[0]);
$.ajax({
type: 'post',
url: "https://echart.doorcome.cn/myexcel.php", //上传文件的请求路径必须是绝对路劲
url: "https://echart.doorcome.cn/charts/myexcel.php", //上传文件的请求路径必须是绝对路劲
data: formData,
cache: false,
processData: false,
@@ -194,8 +194,8 @@ EOF;
console.log("get in ajax!");
var farr = $.parseJSON(data);
$("#codeList").empty();
for(let i=0;i<farr.stocks.length;i++)
$("#codeList").append("<option label='"+farr.stocks[i]['ts_name']+"' value='"+farr.stocks[i]['ts_code']+"'></option>");
for(let i=0;i<farr.data.stocks.length;i++)
$("#codeList").append("<option label='"+farr.data.stocks[i]['ts_name']+"' value='"+farr.data.stocks[i]['ts_code']+"'></option>");
},
error:function () {
alert("数据解析失败!");
@@ -205,4 +205,4 @@ EOF;
});
</script>
</div>
<?php include_once "html/footer.php"; ?>
<?php include_once "../html/footer.php"; ?>
+7 -7
View File
@@ -1,11 +1,11 @@
<?php
include_once "inc/getBasic.inc.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机构持仓趋势:".$ts_name.'('.$_REQUEST['ts_code'].')';
include_once "html/head.php";
include_once "../html/head.php";
?>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
@@ -23,23 +23,23 @@ include_once "html/head.php";
<div >&nbsp;</div>
<div style="width:100%; text-align:center" id='F9'>
<iframe src="https://echart.doorcome.cn/chartSix.php?s=<?=$_REQUEST['t_start']?>&item=F9&ts_code=<?=$_REQUEST['ts_code']?>&e=<?=$_REQUEST['t_end']?>"
<iframe src="https://echart.doorcome.cn/charts/chartSix.php?s=<?=$_REQUEST['t_start']?>&item=F9&ts_code=<?=$_REQUEST['ts_code']?>&e=<?=$_REQUEST['t_end']?>
height="400px" width="1000px"></iframe>
</div>
<div >&nbsp;</div>
<div style="width:100%; text-align:center; " id='F10'>
<iframe src="https://echart.doorcome.cn/chartSix.php?s=<?=$_REQUEST['t_start']?>&item=F10&ts_code=<?=$_REQUEST['ts_code']?>&e=<?=$_REQUEST['t_end']?>"
<iframe src="https://echart.doorcome.cn/charts/chartSix.php?s=<?=$_REQUEST['t_start']?>&item=F10&ts_code=<?=$_REQUEST['ts_code']?>&e=<?=$_REQUEST['t_end']?>
height="400px" width="1000px"></iframe>
</div>
<div >&nbsp;</div>
<div style="width:100%; text-align:center; " id='F11'>
<iframe src="https://echart.doorcome.cn/chartSix.php?s=<?=$_REQUEST['t_start']?>&item=F11&ts_code=<?=$_REQUEST['ts_code']?>&e=<?=$_REQUEST['t_end']?>"
<iframe src="https://echart.doorcome.cn/charts/chartSix.php?s=<?=$_REQUEST['t_start']?>&item=F11&ts_code=<?=$_REQUEST['ts_code']?>&e=<?=$_REQUEST['t_end']?>
height="400px" width="1000px"></iframe>
</div>
<div style="width:100%; text-align:center; " id='F12'>
<iframe src="https://echart.doorcome.cn/chartSix.php?s=<?=$_REQUEST['t_start']?>&item=F12&ts_code=<?=$_REQUEST['ts_code']?>&e=<?=$_REQUEST['t_end']?>"
<iframe src="https://echart.doorcome.cn/charts/chartSix.php?s=<?=$_REQUEST['t_start']?>&item=F12&ts_code=<?=$_REQUEST['ts_code']?>&e=<?=$_REQUEST['t_end']?>
height="400px" width="1000px"></iframe>
</div>
<div >&nbsp;</div>
<?php include_once "html/footer.php"; ?>
<?php include_once "../html/footer.php"; ?>
+4 -4
View File
@@ -1,14 +1,14 @@
<?php
ini_set("display_errors","0");
include_once "inc/getBasic.inc.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";
include_once "../html/head.php";
?>
<script src="js/renderCharts.js"></script>
<script src="../js/renderCharts.js"></script>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
股票代码: <input type='text' name='ts_code' id='ts_code' width="30px" value='<?=$_REQUEST['ts_code']?>' >
开始时间: <input type='date' name='t_start' id='t_start' width='30px' value='<?=$_REQUEST['t_start']?>' >
@@ -141,5 +141,5 @@ include_once "html/head.php";
</script>
</div>
<?php include_once "html/footer.php"; ?>
<?php include_once "../html/footer.php"; ?>
+4 -4
View File
@@ -1,13 +1,13 @@
<?php
include_once "inc/getBasic.inc.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']:'2020-01-01';
$_REQUEST['t_end']=$_REQUEST['t_end']?$_REQUEST['t_end']:date('Y-m-d');
$ts_name = tscodeToName(ts_code_conv($_REQUEST['ts_code']));
$title="股息率趋势:".$ts_name.'('.$_REQUEST['ts_code'].')';
include_once "html/head.php";
include_once "../html/head.php";
?>
<script src="js/renderCharts.js?version=1.0"></script>
<script src="../js/renderCharts.js?version=1.0"></script>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
股票代码: <input type='text' name='ts_code' id='ts_code' width="30px" value='<?=$_REQUEST['ts_code']?>' >
开始时间: <input type='date' name='t_start' id='t_start' width='30px' value='<?=$_REQUEST['t_start']?>' >
@@ -119,5 +119,5 @@ include_once "html/head.php";
</script>
</div>
<?php include_once "html/footer.php"; ?>
<?php include_once "../html/footer.php"; ?>
+4 -4
View File
@@ -1,13 +1,13 @@
<?php
include_once "inc/getBasic.inc.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']:'2020-01-01';
$_REQUEST['t_end']=$_REQUEST['t_end']?$_REQUEST['t_end']:date('Y-m-d');
$ts_name = tscodeToName(ts_code_conv($_REQUEST['ts_code']));
$title="股价VS EP趋势:".$ts_name.'('.$_REQUEST['ts_code'].')';
include_once "html/head.php";
include_once "../html/head.php";
?>
<script src="js/renderCharts.js"></script>
<script src="../js/renderCharts.js"></script>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
股票代码: <input type='text' name='ts_code' id='ts_code' width="30px" value='<?=$_REQUEST['ts_code']?>' >
开始时间: <input type='date' name='t_start' id='t_start' width='30px' value='<?=$_REQUEST['t_start']?>' >
@@ -87,5 +87,5 @@ include_once "html/head.php";
</script>
</div>
<?php include_once "html/footer.php"; ?>
<?php include_once "../html/footer.php"; ?>
+6 -6
View File
@@ -1,8 +1,8 @@
<?php
include_once "inc/getBasic.inc.php";
include_once "inc/getData.inc.php";
include_once "inc/postJson.inc.php";
include_once "inc/getFinanceData.class.php";
include_once "../inc/getBasic.inc.php";
include_once "../inc/getData.inc.php";
include_once "../inc/postJson.inc.php";
include_once "../inc/getFinanceData.class.php";
$_REQUEST['ts_code']=$_REQUEST['ts_code']?$_REQUEST['ts_code']:'000002';
$_REQUEST['yst']=$_REQUEST['yst']?$_REQUEST['yst']:'2015';
@@ -14,7 +14,7 @@ $thWidth = round(1/(count($years)+1)*100,1);
$thWidth .='%';
$urlAppend="ts_code={$_REQUEST['ts_code']}&yst={$_REQUEST['yst']}&yed={$_REQUEST['yed']}";
include_once "html/head.php";
include_once "../html/head.php";
?>
@@ -69,7 +69,7 @@ include_once "html/head.php";
</div>
<?php include_once "html/footer.php"; ?>
<?php include_once "../html/footer.php"; ?>
<script>
$(document).ready(function() {
$('#fina').DataTable( {
+4 -4
View File
@@ -1,14 +1,14 @@
<?php
include_once "inc/getBasic.inc.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']:date('Y-m-d');
$ts_name = tscodeToName(ts_code_conv($_REQUEST['ts_code']));
$title="股价VS融资融券余额:".$ts_name.'('.$_REQUEST['ts_code'].')';
include_once "html/head.php";
include_once "../html/head.php";
?>
<script src="js/renderCharts.js"></script>
<script src="../js/renderCharts.js"></script>
<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">
股票代码: <input type='text' name='ts_code' id='ts_code' width="30px" value='<?=$_REQUEST['ts_code']?>' >
开始时间: <input type='date' name='t_start' id='t_start' width='30px' value='<?=$_REQUEST['t_start']?>' >
@@ -89,5 +89,5 @@ include_once "html/head.php";
}
</script>
<?php include_once "html/footer.php"; ?>
<?php include_once "../html/footer.php"; ?>
+34
View File
@@ -0,0 +1,34 @@
# Continuation
## 当前状态
全部重构任务完成,项目已稳定部署:
### 代码质量改造(9 项全部完成)
- **高优**: SQL 注入防护(参数化查询)、API Token 集中化、config.php 解密
- **中优**: ajax.inc.php 拆分、getBasic.inc.php 渲染函数分离、前端依赖去重
- **低优**: AJAX 响应格式统一、前端全局变量规范化、PHP 8.4 Deprecated 警告修复
### 项目结构整理
- 根目录仅保留 `index.php``index-2.php``phpinfo.php`
- 21 个页面文件移至 `charts/` 子目录,所有内部引用已更新
- 新增 `inc/widgets.inc.php`HTML 组件函数)
- `lib/echarts.min.js``libai/3.4.16.js``research/js/3.4.16.js` 已去重移除
### 环境配置
- PHP 8.4.21 安装于 `d:/software/php8.4/`
- Cursor settings 已更新(VS Code 路径、PHP 路径、终端 PATH
- Git 用户已设为 `Simon2046 / failsafe@163.com`
- `~/.bashrc``sync-echart` 部署函数
- 4 个受损文件(charts/*.php)的行末 `"` 字符已清理
## 后续步骤
1. 访问 `echart.doorcome.cn` 验证各页面功能正常
2. 重点验证改动较大的页面:realestate.php、estate 系列、stockTradeRecord.php
3. 如有需要,运行 `sync-echart` 部署最新改动
## 待解决问题
- `trade_rec()``$extra_where` 参数仍接收原始 SQL 片段(内部参数,非用户输入)
- 无自动化测试,所有验证依赖手动操作
+1 -1
View File
@@ -12,5 +12,5 @@ ini_set('display_errors',1);
<input type="hidden" name="x" id= "x" value='<?php //echo json_encode=($l_x)?>' />
</form>
<script src='../lib/echarts.min.js'></script>
<script src='../js/echarts.min.js'></script>
<script src='js/itrend.basic.js'
+2 -2
View File
@@ -3,11 +3,11 @@
<?php global $title; ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="lib/jquery.min.js?version=3.6.0"></script>
<script type="text/javascript" src="/lib/jquery.min.js?version=3.6.0"></script>
<script type="text/javascript" src="/lib/echarts/5.4.2/echarts.js"></script>
<script type="text/javascript" src="/lib/DataTables-2/datatables.min.js"></script>
<script type="text/javascript" src="/js/pubfunc.js?version=0.14"></script>
<link href="css/style.css?version=0.7" rel="stylesheet" type="text/css">
<link href="/css/style.css?version=0.7" rel="stylesheet" type="text/css">
<link href="/lib/DataTables-2/datatables.min.css" rel="stylesheet" type="text/css">
<title><?=$title?></title>
</head>
+1 -1
View File
@@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<script type="text/javascript" src="lib/jquery.min.js?version=3.6.0"></script>
<script type="text/javascript" src="/lib/jquery.min.js?version=3.6.0"></script>
<script type="text/javascript" src="/lib/echarts/5.4.2/echarts.js"></script>
</head>
<body style="height: 100%; margin: 0">
+50 -188
View File
@@ -1,6 +1,7 @@
<?php
ini_set("display_errors","0");
include_once __DIR__."/config.php";
include_once __DIR__."/getEstate.inc.php";
$mysqli = get_mysqli_connection();
//ajax: get stock list for select
@@ -17,13 +18,9 @@ EOF;
where tprice>0 and ts_code not like '7%' and length(0+ts_name)!=length(ts_name) order by ts_code
EOF;
}
$result = $mysqli->query($sql);
$result = db_query($mysqli, $sql);
$data = $result->fetch_all(MYSQLI_ASSOC);
echo json_encode(array(
"status" => "1",
'stocks'=> $data,
"company"=>$_REQUEST['t_vendor'],
),JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
jsonResponse(['stocks' => $data, 'company' => $_REQUEST['t_vendor']]);
}
/**
@@ -66,7 +63,7 @@ if($_REQUEST['t']=='financeData'){
//strip key from array $data
//dataTable must NOT have any key of json
$data=array_values($data);
echo json_encode(array("data"=>$data),JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
jsonResponse($data);
}
/*
@@ -75,11 +72,7 @@ if($_REQUEST['t']=='financeData'){
if($_REQUEST['t']=='esfTBD'){
$dataTrade=esfTradeDaily();
$dataList=esfListDaily();
echo json_encode(array(
"status" => "1",
'dataTrade'=> $dataTrade,
'dataList'=>$dataList
),JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
jsonResponse(['dataTrade' => $dataTrade, 'dataList' => $dataList]);
}
/*
@@ -88,204 +81,73 @@ if($_REQUEST['t']=='esfTBD'){
if($_REQUEST['t']=='esfListDaily'){
$data=esfListDaily();
echo json_encode(array(
"status" => "1",
'datas'=> $data
),JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
jsonResponse(['datas' => $data]);
}
function esfTradeDaily(){
global $mysqli;
if($_REQUEST['dm']=='Daily'){
$sql= <<<EOF
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='{$_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' 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;
}
function esfListDaily(){
global $mysqli;
if($_REQUEST['dm']=='Daily'){
$sql= <<<EOF
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='{$_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' 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;
}
/*
*newTBD: 新房Trade By Day
*/
if($_REQUEST['t']=='newTBD'){
$district = $_REQUEST['district'];
$t_start = $_REQUEST['t_start'];
$t_end = $_REQUEST['t_end'];
if($_REQUEST['dm']=='Daily'){
$sql= <<<EOF
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='{$_REQUEST['district']}'
$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='1' and (ej.tdate>='{$_REQUEST['t_start']}' and ej.tdate<='{$_REQUEST['t_end']}')
order by date_format(tdate,'%Y-%m-%d') asc
EOF;
where ej.data_type='1' and ej.tdate >= ? and ej.tdate <= ?
order by date_format(tdate,'%Y-%m-%d') asc";
$params = [$district, $t_start, $t_end];
}
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']}'
$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='1' {$where}
group by date_format(tdate,'%Y-%m') order by date_format(tdate,'%Y-%m') asc
EOF;
where ej.data_type='1'";
$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 = $mysqli->query($sql);
$result = db_query($mysqli, $sql, $params);
$data = $result->fetch_all(MYSQLI_ASSOC);
if($_REQUEST['dm']=='Daily'){
$sql= <<<EOF
SELECT
distinct(ej.uuid) uid ,
date_format(tdate,'%Y-%m-%d') td,
eje.val district,
eje1.val area,
eje2.val qty
FROM
`estate_json` ej
left join estate_json_ext eje on ej.uuid=eje.uuid and eje.val='{$_REQUEST['district']}'
$sql2 = "SELECT distinct(ej.uuid) uid, date_format(tdate,'%Y-%m-%d') td, eje.val district, eje1.val area, eje2.val qty
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='4' and (ej.tdate>='{$_REQUEST['t_start']}' and ej.tdate<='{$_REQUEST['t_end']}')
order by date_format(tdate,'%Y-%m-%d') asc
EOF;
where ej.data_type='4' and ej.tdate >= ? and ej.tdate <= ?
order by date_format(tdate,'%Y-%m-%d') asc";
$params2 = [$district, $t_start, $t_end];
}
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']}'
$sql2 = "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 = ?
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;
where ej.data_type='4'";
$params2 = [$district];
if($t_start) { $sql2 .= " and ej.tdate >= ?"; $params2[] = $t_start . '-01'; }
if($t_end) {
$endDate = new DateTime($t_end);
$endDate->modify('last day of this month');
$sql2 .= " and ej.tdate <= ?";
$params2[] = $endDate->format('Y-m-d');
}
$result = $mysqli->query($sql);
$sql2 .= " group by date_format(tdate,'%Y-%m') order by date_format(tdate,'%Y-%m') asc";
}
$result = db_query($mysqli, $sql2, $params2);
$data2 = $result->fetch_all(MYSQLI_ASSOC);
echo json_encode(array(
"status" => "1",
'datas'=> $data,
'dataExt'=> $data2
),JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
jsonResponse(['datas' => $data, 'dataExt' => $data2]);
}
BIN
View File
Binary file not shown.
+1 -2
View File
@@ -60,7 +60,7 @@ EOF;
// 辅助函数:调用TuShare API
function callTushareApi($method, $params){
$token = '1bc28452ba375da19320cda845ae6307578964cb3ae473d0dc702aea';
$token = TUSHARE_API_TOKEN;
// 将参数编码为JSON格式
$postData = json_encode([
"api_name" => $method,
@@ -68,7 +68,6 @@ function callTushareApi($method, $params){
"params" => $params,
"fields" => "" // 其他字段需要根据具体API调整
]);
print_r($postData);
// 初始化cURL会话
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://api.tushare.pro');
+33 -138
View File
@@ -1,6 +1,7 @@
<?php
include_once __DIR__."/config.php";
include_once __DIR__."/functions.inc.php";
include_once __DIR__."/widgets.inc.php";
/**
* 获取PE_TTM,PB,PS等历史数据
@@ -11,19 +12,20 @@ include_once __DIR__."/functions.inc.php";
* @return array
*/
function getBasicData($ts_code,$day_st,$day_end,$item){
$day_st=date('Ymd',strtotime($day_st));
$allowed_items = ['PE_TTM', 'PB', 'PS', 'pe_ttm', 'pb', 'ps'];
if(!in_array($item, $allowed_items)) return array('tDate'=>[],'idx'=>[],'data'=>[],'data_max'=>0,'data_min'=>0,'data_avg'=>0,'data_last'=>0);
$day_st=date('Ymd',strtotime($day_st));
$mysqli = get_mysqli_connection();
$where = " and trade_date>'".$day_st."'";
$sql = "select DATE_FORMAT(trade_date,'%Y-%m-%d') as trade_date, $item as pe_ttm from stock_his_basic_pro where ts_code = ? and trade_date > ?";
$params = [$ts_code, $day_st];
if($day_end) {
$day_end=date('Ymd',strtotime($day_end));
$where .= " and trade_date <'".$day_end."'";
$sql .= " and trade_date < ?";
$params[] = $day_end;
}
$sql= <<<EOF
select DATE_FORMAT(trade_date,'%Y-%m-%d') as trade_date, $item as pe_ttm from stock_his_basic_pro where ts_code = '$ts_code' $where order by trade_date asc
EOF;
#echo $sql;
$result = $mysqli->query($sql);
$sql .= " order by trade_date asc";
$result = db_query($mysqli, $sql, $params);
$tDate=$idx=$data=$data_clean=array(); # $data_clean is an array without null
@@ -75,13 +77,14 @@ function ts_code_conv($ts_code){
function getStockHist($ts_code,$day_st,$day_end){
$mysqli = get_mysqli_connection();
$where = " and trade_date>='".$day_st."'";
if($day_end) $where .= " and trade_date <='".$day_end."'";
$sql= <<<EOF
select trade_date, close from stock_his_pro where ts_code = '$ts_code' $where order by trade_date asc
EOF;
//echo $sql;
$result = $mysqli->query($sql);
$sql = "select trade_date, close from stock_his_pro where ts_code = ? and trade_date >= ?";
$params = [$ts_code, $day_st];
if($day_end) {
$sql .= " and trade_date <= ?";
$params[] = $day_end;
}
$sql .= " order by trade_date asc";
$result = db_query($mysqli, $sql, $params);
$tDate=$idx=$data=array();
@@ -103,9 +106,7 @@ return array('tDate'=>$tDate,'idx'=>$idx,'data'=>$data);
function tscodeToName($ts_code){
$mysqli = get_mysqli_connection();
$sql= "select name from stock_all_pro where ts_code='{$ts_code}'";
$result = $mysqli->query($sql);
$result = db_query($mysqli, "select name from stock_all_pro where ts_code = ?", [$ts_code]);
if($result && $result->num_rows >0) $row = $result->fetch_assoc();
$result->free();
$mysqli->close();
@@ -114,18 +115,23 @@ function tscodeToName($ts_code){
function getBasicExtData($ts_code,$item,$day_st,$day_end){
$mysqli = get_mysqli_connection();
$where = " and trade_date>'".$day_st."' ";
$allowed_items = ['total_mv','circ_mv','total_mv_all','circ_mv_all','pe_ttm','pb','ps','total_share','float_share','free_share'];
if(!in_array($item, $allowed_items)) return array('tDate'=>[],'idx'=>[],'data'=>[],'data_max'=>0,'data_min'=>0,'data_avg'=>0,'data_last'=>0);
$extra_where = "";
if($item=='total_mv_all' or $item=='circ_mv_all') {
$where .= "and vol/10000/10000 > 1";
$extra_where = " and vol/10000/10000 > 1";
$ts_code='all';
$item=substr($item,0,-4);
}
if($day_end) $where .= " and trade_date <'".$day_end."'";
$sql= <<<EOF
select * from stock_basic_ext where code = '$ts_code' and item='$item' $where order by trade_date asc
EOF;
//echo $sql;
$result = $mysqli->query($sql);
$sql = "select * from stock_basic_ext where code = ? and item = ? and trade_date > ?";
$params = [$ts_code, $item, $day_st];
if($day_end) {
$sql .= " and trade_date < ?";
$params[] = $day_end;
}
$sql .= $extra_where . " order by trade_date asc";
$result = db_query($mysqli, $sql, $params);
$tDate=$idx=$data=array();
@@ -164,121 +170,10 @@ function dateGap($date,$gap){
}
/**
* @param string $email: default null
* @return bool true
*/
function tradeStocksList($email=null){
$mysqli = get_mysqli_connection();
if($_REQUEST['t_vendor']=='方正证券'){
$sql= <<< EOF
select distinct(ts_code) ts_code,ts_name from trade_record
where tprice>0 and (ts_code not like '7%' and ts_code not like '1%') and length(trade_id)=5 order by ts_code
EOF;
}elseif($_REQUEST['t_vendor']=='长江证券'){
//length(0+ts_name)!=length(ts_name) 判断ts_name 不能为纯数字
$sql= <<< EOF
select distinct(ts_code) ts_code,ts_name from trade_record_cj
where tprice>0 and ts_code not like '7%' and length(0+ts_name)!=length(ts_name) order by ts_code
EOF;
}
$result = $mysqli->query($sql);
$data = $result->fetch_all(MYSQLI_ASSOC);
$option='';
foreach ( $data as $item){
$option .= "<option label='{$item['ts_name']}' value='{$item['ts_code']}'></option>\n";
}
$html = <<< EOF
<input id="ts_code" name= "ts_code" list="codeList" autocomplete="off"/>
<datalist id="codeList">
$option
</datalist>
<script>
$("#ts_code").val('{$_REQUEST['ts_code']}');
</script>
EOF;
echo $html;
return true;
}
function vendorList($id='t_vendor'){
$html = <<<EOF
<select id="{$id}" name= "{$id}" autocomplete="off" >
<option value="方正证券">方正证券</option>
<option value="长江证券">长江证券</option>
</select>
<script>
$("#{$id}").val('{$_REQUEST[$id]}');
</script>
EOF;
echo $html;
return true;
}
/**
* 根据年份区间,获取财报日期清单
* @param $yst
* @param $yed
*/
function yearList($yst,$yed){
$n = $yed-$yst+1;
$thisYear=date('Y'); //yyyy,eg.2022
$thisMonDay=date('md'); //mmdd,eg.0331
$years=array();
for($i=0;$i<$n;$i++){
if(($yst+$i)<($thisYear-1) ) $years[]=($yst+$i)."1231"; //前年及以前
//去年
if(($yst+$i)==($thisYear-1)and $thisMonDay<='0430') $years[]=($yst+$i)."0930";
if(($yst+$i)==($thisYear-1)and $thisMonDay >'0430') $years[]=($yst+$i)."1231";
//今年
if(($yst+$i)==$thisYear){
switch ($thisMonDay){
case $thisMonDay<='0430':
//一季报未公布do nothing
break;
case $thisMonDay>'0430' && $thisMonDay<= '0831':
//公布一季报
$years[]=($yst+$i)."0331";
break;
case $thisMonDay>'0831' && $thisMonDay<= '1031':
//公布一季报
$years[]=($yst+$i)."0630";
break;
case $thisMonDay>'1031':
//公布一季报
$years[]=($yst+$i)."0930";
break;
default: break;
}
}
}
return $years;
}
/**
* $year 20201231 转为2020年报
* @param $year
*/
function yearToname($year){
switch (substr($year,4,4)){
case '1231':
return substr($year,0,4).'年报';
case '0930':
return substr($year,0,4).'三季';
case '0630':
return substr($year,0,4).'半年';
case '0331':
return substr($year,0,4).'一季';
default:
return substr($year,4,4);
}
}
// 函数一:获取股票代码ts_code对应的历史pe_ttm、pb或ps
function getStockHistoryDataByTS($ts_code, $day_st, $day_end = null, $item){
function getStockHistoryDataByTS($ts_code, $day_st, $item, $day_end = null){
//global $token;
// 参数校验
+42 -42
View File
@@ -9,16 +9,14 @@ include_once __DIR__."/config.php";
function getIndexData($ts_code,$day_st,$day_end){
$mysqli = get_mysqli_connection();
#$ts_code = '000001.SH';
#$day_st = '20000101';
#$day_end = '20190701';
$where = " and trade_date>='".$day_st."'";
if($day_end) $where .= " and trade_date <='".$day_end."'";
$sql= <<<EOF
select trade_date, close from index_hist_pro where ts_code = '$ts_code' $where order by trade_date asc
EOF;
#echo $sql;
$result = $mysqli->query($sql);
$sql = "select trade_date, close from index_hist_pro where ts_code = ? and trade_date >= ?";
$params = [$ts_code, $day_st];
if($day_end) {
$sql .= " and trade_date <= ?";
$params[] = $day_end;
}
$sql .= " order by trade_date asc";
$result = db_query($mysqli, $sql, $params);
$tDate=$idx=$data=array();
@@ -44,24 +42,17 @@ return array('tDate'=>$tDate,'idx'=>$idx,'data'=>$data);
*/
function getIhData($lx,$share,$day_st,$day_end){
$mysqli = get_mysqli_connection();
/*
$where = " and rdate>='".$day_st."'";
if($day_end) $where .= " and rdate<='".$day_end."'";
if($share=='ShareHDNum' or $share=='vPosition') $shareSel='sum('.$share.')/100000000';
elseif($share=='VSRatio') $shareSel='vPosition/ShareHDNum';
$sql= <<<EOF
select rdate,$shareSel as ttl from ih_data where lx='$lx' $where group by rdate order by rdate
EOF;
*/
$where = " and ih_date>='".$day_st."'";
if($day_end) $where .= " and ih_date<='".$day_end."'";
if($share=='ShareHDNum' ) $shareSel="sum(f9)/100000000"; //持股数
elseif($share=='vPosition') $shareSel="sum(f10)/100000000"; //持股额
elseif($share=='VSRatio') $shareSel='f10/f9'; //每股价格
$sql= <<<EOF
select ih_date,$shareSel as ttl from ih_by_ts_code_ext where tp='$lx' $where group by ih_date order by ih_date
EOF;
$result = $mysqli->query($sql);
$sql = "select ih_date,$shareSel as ttl from ih_by_ts_code_ext where tp = ? and ih_date >= ?";
$params = [$lx, $day_st];
if($day_end) {
$sql .= " and ih_date <= ?";
$params[] = $day_end;
}
$sql .= " group by ih_date order by ih_date";
$result = db_query($mysqli, $sql, $params);
//echo $sql;
$tDate=$idx=$data=array();
@@ -177,25 +168,30 @@ function hkholdConv($code){
*/
function getIhDataByStock($ts_code,$item,$lx,$day_st,$day_end){
$mysqli = get_mysqli_connection();
$where = " and ih_date>'".$day_st."'";
if($day_end) $where .= " and ih_date<'".$day_end."'";
if($lx) $where .= " and tp='".$lx."'";
switch(strtoupper($item)){
case 'F9':
$item_sel = 'sum('.$item.')/10000'; #单位万股
$item_sel = 'sum(f9)/10000';
break;
case 'F10':
$item_sel = 'sum('.$item.')/10000'; #单位万元
$item_sel = 'sum(f10)/10000';
break;
case 'F11':
case 'F12':
$item_sel = 'sum('.$item.')'; #单位%
$item_sel = "sum($item)";
break;
}
$sql= <<<EOF
select ts_code,ih_date,$item_sel as ttl from ih_by_ts_code_ext where ts_code='$ts_code' $where group by ih_date order by ih_date asc
EOF;
$result = $mysqli->query($sql);
$sql = "select ts_code,ih_date,$item_sel as ttl from ih_by_ts_code_ext where ts_code = ? and ih_date > ?";
$params = [$ts_code, $day_st];
if($day_end) {
$sql .= " and ih_date < ?";
$params[] = $day_end;
}
if($lx) {
$sql .= " and tp = ?";
$params[] = $lx;
}
$sql .= " group by ih_date order by ih_date asc";
$result = db_query($mysqli, $sql, $params);
#echo $sql;
$tDate=$idx=$data=array();
@@ -221,15 +217,19 @@ EOF;
function getMoneyFlowData($itm, $day_st,$day_end, $stacked){
$mysqli = get_mysqli_connection();
$allowed_cols = ['ggt_ss','ggt_sz','hgt','sgt','north_money','south_money'];
if(!in_array($itm, $allowed_cols)) return array('tDate'=>[],'data'=>[],'data_max'=>0,'data_min'=>0,'data_avg'=>0,'data_last'=>0);
if($stacked==1) $tb = 'moneyflow_hsgt_pro_ext';
else $tb = 'moneyflow_hsgt_pro';
$where = " trade_date>='".$day_st."'";
if($day_end) $where .= " and trade_date <='".$day_end."'";
$sql= <<<EOF
select trade_date, $itm as itm from $tb where $where order by trade_date asc
EOF;
#echo $sql;
$result = $mysqli->query($sql);
$sql = "select trade_date, $itm as itm from $tb where trade_date >= ?";
$params = [$day_st];
if($day_end) {
$sql .= " and trade_date <= ?";
$params[] = $day_end;
}
$sql .= " order by trade_date asc";
$result = db_query($mysqli, $sql, $params);
$tDate=$data=array();
+83 -6
View File
@@ -1,12 +1,9 @@
<?php
include_once __DIR__."/config.php";
function getEstateData($city='宁波',$fDate,$toDate){
function getEstateData($city, $fDate, $toDate){
$mysqli = get_mysqli_connection();
$sql=<<<EOF
SELECT city, listdate,sum(nums) as num FROM `estate_listing`
where listdate>='$fDate' and listdate<='$toDate' and city='$city' group by listdate
EOF;
$result = $mysqli->query($sql);
$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()){
@@ -16,4 +13,84 @@ EOF;
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;
}
?>
+5 -5
View File
@@ -4,17 +4,17 @@ include_once __DIR__."/getBasic.inc.php"; //类外调用方法
class getFinance
{
private $url = "http://api.waditu.com";
private $token = '1bc28452ba375da19320cda845ae6307578964cb3ae473d0dc702aea';
public $ts_code = '002273.SZ'; //set ts_code default
public $httpjsonStr; //json string send to http_post_json
private $token;
public $ts_code = '002273.SZ';
public $httpjsonStr;
public $finDate;
public $preFinDate;
public $param = array();
private $unitFactor = 100000000; //单位因子,除以后单位亿
private $unitFactor = 100000000;
function __construct()
{
$this->token = TUSHARE_API_TOKEN;
$this->param['token'] = $this->token;
}
/**
+11 -15
View File
@@ -5,23 +5,19 @@
* @param $where: add select condition you need.
* @return array: return stock trade recode history data;
*/
function trade_rec($ts_code, $day_st, $day_end,$where = ''): array
function trade_rec($ts_code, $day_st, $day_end, $extra_where = ''): array
{
global $mysqli;
$tmp=explode('.',$ts_code);
$ts_code = $tmp[0];
$day_end = ($day_end)?$day_end:date('Y-m-d');
$where = $where." and tdate>= '{$day_st}' and tdate<='{$day_end}' and tprice>0"; //担保转出的时候,可能tprice<0
if($_REQUEST['t_vendor']=='方正证券') {
$sql = <<< EOF
select * from trade_record where ts_code = '$ts_code' $where and length(trade_id)=5 order by tdate asc,ttime asc
EOF;
} elseif($_REQUEST['t_vendor']=='长江证券') {
$sql = <<< EOF
select * from trade_record_cj where ts_code = '$ts_code' $where order by tdate asc,ttime asc
EOF;
$vendor = $_REQUEST['t_vendor'] ?? '方正证券';
if($vendor == '方正证券') {
$sql = "select * from trade_record where ts_code = ? and tdate >= ? and tdate <= ? and tprice>0 $extra_where and length(trade_id)=5 order by tdate asc,ttime asc";
} elseif($vendor == '长江证券') {
$sql = "select * from trade_record_cj where ts_code = ? and tdate >= ? and tdate <= ? and tprice>0 $extra_where order by tdate asc,ttime asc";
}
$result = $mysqli->query($sql) or die($sql);
$result = db_query($mysqli, $sql, [$ts_code, $day_st, $day_end]);
return $result->fetch_all(MYSQLI_ASSOC);
}
@@ -134,10 +130,10 @@ function tradeSummary($dataBuy,$dataSell,$dataAll):array{
function recentPrice($ts_code){
global $mysqli;
$sql = "SELECT close FROM `stock_his_pro` where ts_code='".ts_code_conv($ts_code)."' and trade_date=(select max(trade_date) from stock_his_pro)";
$result = $mysqli->query($sql) or die($sql);
$rt = $result->fetch_all(MYSQLI_ASSOC); //MYSQLI_ASSOC object $rt[0]['close']
return $rt[0]; //get arr['close']
$sql = "SELECT close FROM stock_his_pro where ts_code = ? and trade_date=(select max(trade_date) from stock_his_pro)";
$result = db_query($mysqli, $sql, [ts_code_conv($ts_code)]);
$rt = $result->fetch_all(MYSQLI_ASSOC);
return $rt[0];
}
/**
+117
View File
@@ -0,0 +1,117 @@
<?php
include_once __DIR__."/config.php";
/**
* 显示股票代码选择列表 (datalist widget)
* @param string $email: default null
* @return bool true
*/
function tradeStocksList($email=null){
$mysqli = get_mysqli_connection();
if($_REQUEST['t_vendor']=='方正证券'){
$sql= <<< EOF
select distinct(ts_code) ts_code,ts_name from trade_record
where tprice>0 and (ts_code not like '7%' and ts_code not like '1%') and length(trade_id)=5 order by ts_code
EOF;
}elseif($_REQUEST['t_vendor']=='长江证券'){
//length(0+ts_name)!=length(ts_name) 判断ts_name 不能为纯数字
$sql= <<< EOF
select distinct(ts_code) ts_code,ts_name from trade_record_cj
where tprice>0 and ts_code not like '7%' and length(0+ts_name)!=length(ts_name) order by ts_code
EOF;
}
$result = $mysqli->query($sql);
$data = $result->fetch_all(MYSQLI_ASSOC);
$option='';
foreach ( $data as $item){
$option .= "<option label='{$item['ts_name']}' value='{$item['ts_code']}'></option>\n";
}
$ts_code_val = htmlspecialchars($_REQUEST['ts_code'] ?? '', ENT_QUOTES);
$html = <<< EOF
<input id="ts_code" name= "ts_code" list="codeList" autocomplete="off"/>
<datalist id="codeList">
$option
</datalist>
<script>
$("#ts_code").val('$ts_code_val');
</script>
EOF;
echo $html;
return true;
}
function vendorList($id='t_vendor'){
$val = htmlspecialchars($_REQUEST[$id] ?? '', ENT_QUOTES);
$html = <<<EOF
<select id="{$id}" name= "{$id}" autocomplete="off" >
<option value="方正证券">方正证券</option>
<option value="长江证券">长江证券</option>
</select>
<script>
$("#{$id}").val('{$val}');
</script>
EOF;
echo $html;
return true;
}
/**
* 根据年份区间,获取财报日期清单
* @param $yst
* @param $yed
*/
function yearList($yst,$yed){
$n = $yed-$yst+1;
$thisYear=date('Y'); //yyyy,eg.2022
$thisMonDay=date('md'); //mmdd,eg.0331
$years=array();
for($i=0;$i<$n;$i++){
if(($yst+$i)<($thisYear-1) ) $years[]=($yst+$i)."1231"; //前年及以前
//去年
if(($yst+$i)==($thisYear-1)and $thisMonDay<='0430') $years[]=($yst+$i)."0930";
if(($yst+$i)==($thisYear-1)and $thisMonDay >'0430') $years[]=($yst+$i)."1231";
//今年
if(($yst+$i)==$thisYear){
switch ($thisMonDay){
case $thisMonDay<='0430':
//一季报未公布do nothing
break;
case $thisMonDay>'0430' && $thisMonDay<= '0831':
//公布一季报
$years[]=($yst+$i)."0331";
break;
case $thisMonDay>'0831' && $thisMonDay<= '1031':
//公布一季报
$years[]=($yst+$i)."0630";
break;
case $thisMonDay>'1031':
//公布一季报
$years[]=($yst+$i)."0930";
break;
default: break;
}
}
}
return $years;
}
/**
* $year 20201231 转为2020年报
* @param $year
*/
function yearToname($year){
switch (substr($year,4,4)){
case '1231':
return substr($year,0,4).'年报';
case '0930':
return substr($year,0,4).'三季';
case '0630':
return substr($year,0,4).'半年';
case '0331':
return substr($year,0,4).'一季';
default:
return substr($year,4,4);
}
}
+15 -15
View File
@@ -82,32 +82,32 @@
</div>
<div class="space-y-3">
<a href="#" onclick="openurl('https://echart.doorcome.cn/stock_trend.php');"
<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/stock_trend.php');"
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
<i class="fa-solid fa-arrow-trend-up text-primary w-6"></i>
<span>股价VS PE/PB/PS 趋势</span>
</a>
<a href="#" onclick="openurl('https://echart.doorcome.cn/stockep.php');"
<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/stockep.php');"
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
<i class="fa-solid fa-balance-scale text-secondary w-6"></i>
<span>股价VS EP</span>
</a>
<a href="#" onclick="openurl('https://echart.doorcome.cn/stockmargin.php');"
<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/stockmargin.php');"
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
<i class="fa-solid fa-money-bill-wave text-green-500 w-6"></i>
<span>股价VS 融资融券余额</span>
</a>
<!--<a href="#" onclick="openurl('https://echart.doorcome.cn/hkholdbycode.php');"
<!--<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/hkholdbycode.php');"
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
<i class="fa-solid fa-globe-asia text-blue-500 w-6"></i>
<span>股价VS 北向资金持股</span>-->
</a>
<a href="#" onclick="openurl('https://echart.doorcome.cn/stock_ih.php');"
<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/stock_ih.php');"
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
<i class="fa-solid fa-building-columns text-purple-500 w-6"></i>
<span>股价VS 机构持仓趋势</span>
</a>
<a href="#" onclick="openurl('https://echart.doorcome.cn/stockkeydata.php');"
<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/stockkeydata.php');"
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
<i class="fa-solid fa-table text-yellow-500 w-6"></i>
<span>个股基本面数据</span>
@@ -117,27 +117,27 @@
<div class="mt-6 pt-6 border-t border-gray-200">
<h4 class="font-medium mb-3">指数分析</h4>
<div class="space-y-3">
<a href="#" onclick="openurl('https://echart.doorcome.cn/index_trend.php');"
<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/index_trend.php');"
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
<i class="fa-solid fa-chart-area text-indigo-500 w-6"></i>
<span>指数VS PE/PB/PS/市值 趋势</span>
</a>
<a href="#" onclick="openurl('https://echart.doorcome.cn/index_ih.php');"
<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/index_ih.php');"
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
<i class="fa-solid fa-institution text-teal-500 w-6"></i>
<span>指数VS 机构持仓趋势</span>
</a>
<a href="#" onclick="openurl('https://echart.doorcome.cn/index_mv_all.php');"
<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/index_mv_all.php');"
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
<i class="fa-solid fa-chart-pie text-orange-500 w-6"></i>
<span>指数VS 两市总市值</span>
</a>
<a href="#" onclick="openurl('https://echart.doorcome.cn/index_margin.php');"
<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/index_margin.php');"
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
<i class="fa-solid fa-bank text-red-500 w-6"></i>
<span>指数VS 融资余额</span>
</a>
<!--<a href="#" onclick="openurl('https://echart.doorcome.cn/moneyflow.php');"
<!--<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/moneyflow.php');"
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
<i class="fa-solid fa-exchange text-pink-500 w-6"></i>
<span>指数VS 沪深港通资金流向</span>
@@ -160,22 +160,22 @@
</div>
<div class="space-y-3">
<a href="https://echart.doorcome.cn/realestate.php" target="_blank"
<a href="https://echart.doorcome.cn/charts/realestate.php" 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-building text-blue-500 w-6"></i>
<span>房地产挂牌数量趋势(宁波)</span>
</a>
<a href="https://echart.doorcome.cn/estateNewTradeDaily.php" target="_blank"
<a href="https://echart.doorcome.cn/charts/estateNewTradeDaily.php" 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-key text-green-500 w-6"></i>
<span>新房每日成交量(宁波)</span>
</a>
<a href="https://echart.doorcome.cn/estateTradeDaily.php" target="_blank"
<a href="https://echart.doorcome.cn/charts/estateTradeDaily.php" 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-exchange-alt text-yellow-500 w-6"></i>
<span>二手房每日成交量(宁波)</span>
</a>
<a href="https://echart.doorcome.cn/estateListDaily.php" target="_blank"
<a href="https://echart.doorcome.cn/charts/estateListDaily.php" 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-list-alt text-purple-500 w-6"></i>
<span>二手房每日挂牌量(宁波)</span>
+14 -14
View File
@@ -22,27 +22,27 @@ $_REQUEST['ts_code']=$_REQUEST['ts_code']?$_REQUEST['ts_code']:'600000';
<div style="text-align: center; margin:0 auto; width: 840px;">
<div style="clear:both;position: relative; float:left; text-align:center; margin: 0 auto;width:400px;height: 400px; ">
<div class="div_block">个股:股票代码: <input type='text' name='ts_code' id='ts_code' size="12" value='<?=$_REQUEST['ts_code']?>' ></div>
<div class="div_block">个股:<a href="#" onclick="openurl('https://echart.doorcome.cn/stock_trend.php');">股价VS PE/PB/PS 趋势</a></div>
<div class="div_block">个股:<a href="#" onclick="openurl('https://echart.doorcome.cn/stockep.php');">股价VS EP</a></div>
<div class="div_block">个股:<a href="#" onclick="openurl('https://echart.doorcome.cn/stockdiv.php');">股价VS 股息率</a></div>
<div class="div_block">个股:<a href="#" onclick="openurl('https://echart.doorcome.cn/stockmargin.php');">股价VS 融资融券余额</a></div>
<div class="div_block">个股:<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/stock_trend.php');">股价VS PE/PB/PS 趋势</a></div>
<div class="div_block">个股:<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/stockep.php');">股价VS EP</a></div>
<div class="div_block">个股:<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/stockdiv.php');">股价VS 股息率</a></div>
<div class="div_block">个股:<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/stockmargin.php');">股价VS 融资融券余额</a></div>
<!--<div class="div_block">个股:<a href="#" onclick="openurl('https://echart.doorcome.cn/hkholdbycode.php');">股价VS 北向资金持股</a></div>-->
<div class='div_block'>个股:<a href="#" onclick="openurl('https://echart.doorcome.cn/stock_ih.php');">股价VS 机构持仓趋势</a></div>
<div class='div_block'>个股:<a href="#" onclick="openurl('https://echart.doorcome.cn/stockkeydata.php');">个股基本面数据</a></div>
<div class='div_block'>指数:<a href="#" onclick="openurl('https://echart.doorcome.cn/index_trend.php');">指数VS PE/PB/PS/市值 趋势</a>
<div class='div_block'>个股:<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/stock_ih.php');">股价VS 机构持仓趋势</a></div>
<div class='div_block'>个股:<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/stockkeydata.php');">个股基本面数据</a></div>
<div class='div_block'>指数:<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/index_trend.php');">指数VS PE/PB/PS/市值 趋势</a>
</div>
<div class='div_block'>指数:<a href="#" onclick="openurl('https://echart.doorcome.cn/index_ih.php');">指数VS 机构持仓趋势</a></div>
<div class='div_block'>指数:<a href="#" onclick="openurl('https://echart.doorcome.cn/index_mv_all.php');">指数VS 两市总市值</a></div>
<div class='div_block'>指数:<a href="#" onclick="openurl('https://echart.doorcome.cn/index_margin.php');">指数VS 融资余额</a></div>
<div class='div_block'>指数:<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/index_ih.php');">指数VS 机构持仓趋势</a></div>
<div class='div_block'>指数:<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/index_mv_all.php');">指数VS 两市总市值</a></div>
<div class='div_block'>指数:<a href="#" onclick="openurl('https://echart.doorcome.cn/charts/index_margin.php');">指数VS 融资余额</a></div>
<!--<div class='div_block'>指数:<a href="#" onclick="openurl('https://echart.doorcome.cn/moneyflow.php');">指数VS 沪深港通资金流向</a></div> -->
</div>
<div style="text-align:center; margin: 0 auto;float: left;position: relative;width:400px; ">
<div class='div_block'>房产:<a href="https://echart.doorcome.cn/realestate.php" target='_blank'>房地产挂牌数量趋势(宁波)</a></div>
<div class='div_block'>房产:<a href="https://echart.doorcome.cn/estateNewTradeDaily.php" target='_blank'>新房每日成交量(宁波)</a></div>
<div class='div_block'>房产:<a href="https://echart.doorcome.cn/estateTradeDaily.php" target='_blank'>二手房每日成交量(宁波)</a></div>
<div class='div_block'>房产:<a href="https://echart.doorcome.cn/estateListDaily.php" target='_blank'>二手房每日挂牌量(宁波)</a></div>
<div class='div_block'>房产:<a href="https://echart.doorcome.cn/charts/realestate.php" target='_blank'>房地产挂牌数量趋势(宁波)</a></div>
<div class='div_block'>房产:<a href="https://echart.doorcome.cn/charts/estateNewTradeDaily.php" target='_blank'>新房每日成交量(宁波)</a></div>
<div class='div_block'>房产:<a href="https://echart.doorcome.cn/charts/estateTradeDaily.php" target='_blank'>二手房每日成交量(宁波)</a></div>
<div class='div_block'>房产:<a href="https://echart.doorcome.cn/charts/estateListDaily.php" target='_blank'>二手房每日挂牌量(宁波)</a></div>
</div>
</div>
<div style="clear: both;text-align: center; margin:0 auto; width: 840px;"><a href="index-2.php">首页导航进阶版</a></div>
+10 -9
View File
@@ -1,3 +1,4 @@
var cfg = window.chartConfig;
// ajax with adj set 1
$(function () {
jQuery.support.cors = true;
@@ -21,15 +22,15 @@ $(function () {
console.log("Get data sucessfully");
var adj = getAdj(data);
//console.log(adj);
console.log(data1[0]['value'][0]);
console.log(data1[0]['value'][1]);
data1 = adjData(adj,data1,'price');
data2 = adjData(adj,data2,'price');
data3 = adjData(adj,data3,'price');
data4 = adjData(adj,data4,'volum');
data5 = adjData(adj,data5,'volum');
console.log(data1[0]['value'][0]);
console.log(data1[0]['value'][1]);
console.log(cfg.data[0]['value'][0]);
console.log(cfg.data[0]['value'][1]);
cfg.data = adjData(adj,cfg.data,'price');
cfg.data2 = adjData(adj,cfg.data2,'price');
cfg.data3 = adjData(adj,cfg.data3,'price');
cfg.data4 = adjData(adj,cfg.data4,'volum');
cfg.data5 = adjData(adj,cfg.data5,'volum');
console.log(cfg.data[0]['value'][0]);
console.log(cfg.data[0]['value'][1]);
//重新执行画图
if (option && typeof option === "object") {
myChart.setOption(option, true);
+11 -10
View File
@@ -1,3 +1,4 @@
var cfg = window.chartConfig;
$(function (){
var dom = document.getElementById("container");
var myChart = echarts.init(dom,'dark');
@@ -5,9 +6,9 @@ $(function (){
var option = null;
option = {
title: {
//text: legend[0]+' V.S '+legend[2],
text: headtxt,
subtext: subtxt,
//text: cfg.legend[0]+' V.S '+cfg.legend[2],
text: cfg.title,
subtext: cfg.subtitle,
textAlign:'center',
left:'50%'
},
@@ -15,7 +16,7 @@ $(function (){
trigger: 'axis'
},
legend: {
data:legend,
data: cfg.legend,
right:'20'
},
grid: {
@@ -36,12 +37,12 @@ $(function (){
},
yAxis: [{
type: 'value',
name:legend[0], //图列
name: cfg.legend[0], //图列
show:true
},
{
type:'value',
name:legend[2]+unit, //图例
name: cfg.legend[2]+cfg.unit, //图例
//scale:true,
boundaryGap:false,
show:true,
@@ -69,19 +70,19 @@ $(function (){
}],
series: [
{
name:legend[0],
name: cfg.legend[0],
type:'line',
yAxisIndex:0,
symbol:'none',
data:data1
data: cfg.data
},
{
name:legend[2],
name: cfg.legend[2],
type:'line',
yAxisIndex:1,
symbol:'none', //数据圆点
smooth:false,
data: data2
data: cfg.data2
}
]
};
+20 -19
View File
@@ -1,15 +1,16 @@
var cfg = window.chartConfig;
var dom = document.getElementById("container");
var myChart = echarts.init(dom,'dark'); //内置主题:dark, grey,bright,light
var app = {};
option = null;
console.log(data1[0]['value'][0]);
console.log(data1[0]['value'][1]);
console.log(cfg.data[0]['value'][0]);
console.log(cfg.data[0]['value'][1]);
option = {
//backgroundColor: '',
title: {
//text: legend[0]+' V.S '+legend[2],
text: headtxt,
subtext: subtxt,
//text: cfg.legend[0]+' V.S '+cfg.legend[2],
text: cfg.title,
subtext: cfg.subtitle,
textAlign:'center',
left:'50%'
},
@@ -18,11 +19,11 @@ option = {
},
legend: [
{
data:[legend[0],legend[1],legend[2]],
data: [cfg.legend[0],cfg.legend[1],cfg.legend[2]],
right:'50',
},
{
data:[legend[3],legend[4]],
data: [cfg.legend[3],cfg.legend[4]],
right:'100',
top:'30',
},
@@ -45,13 +46,13 @@ option = {
},
yAxis: [{
type: 'value',
name:legend[0], //图列
name:cfg.legend[0], //图列
show:true,
scale:true,
},
{
type:'value',
name:unit, //图例
name: cfg.unit, //图例
scale:true, //自动缩放
boundaryGap:false,
show:true,
@@ -85,47 +86,47 @@ option = {
}],
series: [
{
name:legend[0],
name:cfg.legend[0],
type:'line',
yAxisIndex:0,
symbol:'none',
smooth:false,
data: data1,
data: cfg.data,
},
{
name:legend[1],
name:cfg.legend[1],
type:'scatter', //散点图
yAxisIndex:0,
symbolSize: 10,
smooth:false,
data: data2,
data: cfg.data2,
},
{
name:legend[2],
name:cfg.legend[2],
type:'scatter', //散点图
yAxisIndex:0,
symbolSize: 10,
smooth:false,
data: data3
data: cfg.data3
},
{
name:legend[3],
name:cfg.legend[3],
type:'bar',
yAxisIndex:1,
symbolSize: 0,
barWidth: 1,
smooth:false,
data: data4,
data: cfg.data4,
},
{
name:legend[4],
name:cfg.legend[4],
type:'bar',
yAxisIndex:1,
symbolSize: 0,
barWidth: 1,
smooth:false,
data: data5,
data: cfg.data5,
}
]
};
+6 -5
View File
@@ -1,3 +1,4 @@
var cfg = window.chartConfig;
var dom = document.getElementById("container");
var myChart = echarts.init(dom,'dark');
var app = {};
@@ -6,8 +7,8 @@ option = null;
option = {
title: {
//text: legend[0]+' V.S '+legend[2],
text: headtxt,
subtext: subtxt,
text: cfg.title,
subtext: cfg.subtitle,
textAlign:'center',
left:'50%'
},
@@ -15,7 +16,7 @@ option = {
trigger: 'axis'
},
legend: {
data:legend,
data: cfg.legend,
right:'20'
},
grid: {
@@ -74,7 +75,7 @@ option = {
type:'line',
yAxisIndex:0,
symbol:'none',
data:data1,
data: cfg.data,
},
{
name:legend[1],
@@ -82,7 +83,7 @@ option = {
yAxisIndex:1,
symbol:'none', //数据圆点
smooth:false,
data:data2,
data: cfg.data2,
}
]
};
+7 -6
View File
@@ -1,3 +1,4 @@
var cfg = window.chartConfig;
var dom = document.getElementById("container");
var myChart = echarts.init(dom,'dark');
var app = {};
@@ -5,8 +6,8 @@ option = null;
option = {
title: {
//text: legend[0]+' V.S '+legend[2],
text: headtxt,
//text: cfg.legend[0]+' V.S '+cfg.legend[2],
text: cfg.title,
//subtext: subtxt,
textAlign:'center',
left:'50%'
@@ -15,7 +16,7 @@ option = {
trigger: 'axis'
},
legend: {
data:legend,
data:cfg.legend,
right:'20'
},
grid: {
@@ -36,7 +37,7 @@ option = {
},
yAxis: [{
type: 'value',
name:legend[0], //图列
name:cfg.legend[0], //图列
show:true,
scale:true,
//min:190000,
@@ -61,11 +62,11 @@ option = {
}],
series: [
{
name:legend[0],
name:cfg.legend[0],
type:'line',
yAxisIndex:0,
symbol:'none',
data:data1,
data:cfg.data,
itemStyle:{normal:{label:{show:true}}}, //显示数字
}
]
-22
View File
File diff suppressed because one or more lines are too long
-83
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>中国AI产业链深度研究报告</title>
<script src="/research/js/3.4.16.js"></script>
<script src="/js/tailwindcss_3.4.17.js"></script>
<link href="/research/js/font-awesome.min.css" rel="stylesheet">
<script src="/research/js/chart.js"></script>
+1 -1
View File
@@ -2,7 +2,7 @@
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>中国AI产业链深度研究报告:投资决策参考</title>
<script src="/research/js/3.4.16.js"></script>
<script src="/js/tailwindcss_3.4.17.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700&amp;family=Inter:wght@300;400;500;600;700&amp;display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="/research/js/all.min.css"/>
<script src="https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.js"></script>
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>产业链分析 - AI产业链护城河深度分析</title>
<script src="/research/js/3.4.16.js"></script>
<script src="/js/tailwindcss_3.4.17.js"></script>
<script src="/libai/anime.min.js"></script>
<script src="/js/echarts.min.js"></script>
<script src="/libai/shader-park-core.esm.js" type="module"></script>
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI产业链上市公司护城河深度分析</title>
<script src="/research/js/3.4.16.js"></script>
<script src="/js/tailwindcss_3.4.17.js"></script>
<script src="/libai/anime.min.js"></script>
<script src="/js/echarts.min.js"></script>
<script src="/libai/shader-park-core.esm.js" type="module"></script>