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:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
ini_set("display_errors","1");
|
||||
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";
|
||||
|
||||
$file = $_REQUEST['fpath'];
|
||||
$company = $_REQUEST['up_vendor'];
|
||||
$msg = array();
|
||||
/*
|
||||
echo json_encode(array(
|
||||
"status" => "2",
|
||||
"fpath"=> $file,
|
||||
'company'=> $_REQUEST['up_vendor'],
|
||||
"msg" => "upload sucessful!",
|
||||
));
|
||||
*/
|
||||
$data = readMyExcel($file);
|
||||
$msg[] = addslashes("Finished excel read! <br />");
|
||||
$msg_op = dbOp($data, $company);
|
||||
if($msg_op == false) exit(); //if return false, function dbOp() will echo massage to ajax
|
||||
$msg = array_merge($msg,$msg_op);
|
||||
echo json_encode(array(
|
||||
"status" => "1",
|
||||
"fpath"=> $file,
|
||||
'company'=> $_REQUEST['up_vendor'],
|
||||
"msg" => $msg,
|
||||
));
|
||||
?>
|
||||
Reference in New Issue
Block a user