v1.0.51: 批次1架构筑基 - 1)版本迁移(common/migrate.php+schema_versions+natsort迁移文件);2)登录安全(bcrypt平滑迁移login/user_add/user_update旧sha1命中自动重写+system_login_attempts限流+session加固httponly/samesite/secure);3)CSRF Token(服务端checkCsrf+auth/csrf.php登录页取token+前端common.js/login.js统一携带X-CSRF-Token);4)统一基座common/Api.php并存量强制迁移全部70个endpoint(Api::boot按public/super/module/permissions分流,写接口强制checkAjax+checkCsrf,全局异常处理);5)前端收敛(common.js新增esc转义别名);6)REV-4硬数据来源渠道可编辑(hard_update+补全弹窗下拉);7)prepared卫生(soft_update.php修复+analysis.php表名白名单REV-9)
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
+2
-7
@@ -3,14 +3,9 @@
|
||||
* 需求新增接口 POST /api/need/add.php
|
||||
* 必填:company_id;可选白名单字段见 NEED_FIELDS
|
||||
*/
|
||||
require_once __DIR__ . '/../common/db.php';
|
||||
require_once __DIR__ . '/../common/response.php';
|
||||
require_once __DIR__ . '/../common/auth.php';
|
||||
require_once __DIR__ . '/../common/logger.php';
|
||||
require_once __DIR__ . '/../common/helpers.php';
|
||||
require_once __DIR__ . '/../common/Api.php';
|
||||
$pdo = Api::boot(['module' => 'need']);
|
||||
|
||||
checkAjax();
|
||||
checkPermission('need');
|
||||
|
||||
$data = extractFields(NEED_FIELDS);
|
||||
if (empty($data['company_id'])) {
|
||||
|
||||
+2
-6
@@ -3,13 +3,9 @@
|
||||
* 需求删除接口(作废) POST /api/need/delete.php
|
||||
* 入参:id(或 ids 逗号分隔批量)
|
||||
*/
|
||||
require_once __DIR__ . '/../common/db.php';
|
||||
require_once __DIR__ . '/../common/response.php';
|
||||
require_once __DIR__ . '/../common/auth.php';
|
||||
require_once __DIR__ . '/../common/logger.php';
|
||||
require_once __DIR__ . '/../common/Api.php';
|
||||
$pdo = Api::boot(['module' => 'need']);
|
||||
|
||||
checkAjax();
|
||||
checkPermission('need');
|
||||
|
||||
$id = (int)($_POST['id'] ?? 0);
|
||||
$ids = trim($_POST['ids'] ?? '');
|
||||
|
||||
+2
-4
@@ -2,11 +2,9 @@
|
||||
/**
|
||||
* 需求详情接口 GET /api/need/detail.php?id=1
|
||||
*/
|
||||
require_once __DIR__ . '/../common/db.php';
|
||||
require_once __DIR__ . '/../common/response.php';
|
||||
require_once __DIR__ . '/../common/auth.php';
|
||||
require_once __DIR__ . '/../common/Api.php';
|
||||
$pdo = Api::boot(['module' => 'need']);
|
||||
|
||||
checkPermission('need');
|
||||
|
||||
$id = (int)($_REQUEST['id'] ?? 0);
|
||||
if ($id <= 0) {
|
||||
|
||||
+2
-4
@@ -3,11 +3,9 @@
|
||||
* 需求转盘列表接口 GET/POST /api/need/list.php
|
||||
* 参数:page / limit / keyword / start_date / end_date / company_name / industry / need_category / is_valid
|
||||
*/
|
||||
require_once __DIR__ . '/../common/db.php';
|
||||
require_once __DIR__ . '/../common/response.php';
|
||||
require_once __DIR__ . '/../common/auth.php';
|
||||
require_once __DIR__ . '/../common/Api.php';
|
||||
$pdo = Api::boot(['module' => 'need']);
|
||||
|
||||
checkPermission('need');
|
||||
|
||||
[$page, $limit] = pageParams();
|
||||
$keyword = trim($_REQUEST['keyword'] ?? '');
|
||||
|
||||
+2
-6
@@ -5,13 +5,9 @@
|
||||
* 说明:当前为占位实现,仅写日志并返回成功;
|
||||
* 后续可扩展为调用第三方API推送JSON数据 / 通过SMTP发送邮件。
|
||||
*/
|
||||
require_once __DIR__ . '/../common/db.php';
|
||||
require_once __DIR__ . '/../common/response.php';
|
||||
require_once __DIR__ . '/../common/auth.php';
|
||||
require_once __DIR__ . '/../common/logger.php';
|
||||
require_once __DIR__ . '/../common/Api.php';
|
||||
$pdo = Api::boot(['module' => 'need']);
|
||||
|
||||
checkAjax();
|
||||
checkPermission('need');
|
||||
|
||||
$id = (int)($_POST['id'] ?? 0);
|
||||
$ids = trim($_POST['ids'] ?? '');
|
||||
|
||||
+2
-7
@@ -3,14 +3,9 @@
|
||||
* 需求编辑接口 POST /api/need/update.php
|
||||
* 入参:id + 白名单字段(可含 is_valid 作废/恢复)
|
||||
*/
|
||||
require_once __DIR__ . '/../common/db.php';
|
||||
require_once __DIR__ . '/../common/response.php';
|
||||
require_once __DIR__ . '/../common/auth.php';
|
||||
require_once __DIR__ . '/../common/logger.php';
|
||||
require_once __DIR__ . '/../common/helpers.php';
|
||||
require_once __DIR__ . '/../common/Api.php';
|
||||
$pdo = Api::boot(['module' => 'need']);
|
||||
|
||||
checkAjax();
|
||||
checkPermission('need');
|
||||
|
||||
$id = (int)($_POST['id'] ?? 0);
|
||||
if ($id <= 0) {
|
||||
|
||||
Reference in New Issue
Block a user