第64批:信仰积分系统PHP端 - credit.php: credit_rules 表新增 amount 列(规则参数值) + sync_pull 返回 rules 数组 + update_rule 支持 amount 全参数 + __rules_sync__ 通知Java规则变更 - admin.php: 规则编辑弹窗支持 amount 输入 + 阈值显示修正 - sync.php: 规则同步流程接入

This commit is contained in:
ypsdf1
2026-10-30 13:11:44 +08:00
parent 69aa36a3d1
commit cfd4375788
3 changed files with 213 additions and 24 deletions
+4 -6
View File
@@ -4347,12 +4347,10 @@ function notifySync() {
$db->exec("CREATE TABLE IF NOT EXISTS web_transactions (id INTEGER PRIMARY KEY AUTOINCREMENT, player_name TEXT NOT NULL, type TEXT NOT NULL, amount INTEGER NOT NULL, operator TEXT DEFAULT '', reason TEXT, detail TEXT, status TEXT DEFAULT 'pending', created_at INTEGER NOT NULL, processed_at INTEGER)");
$txId = getParam('tx_id', 0);
// 写入同步通知文件(包含交易ID)
$notifyFile = __DIR__ . '/../../sync_notify.txt';
$notifyData = json_encode(['time' => time(), 'tx_id' => (int)$txId]);
@file_put_contents($notifyFile, $notifyData, LOCK_EX);
// ★ 不再使用HTTP回调,Java的transactionPolling每5秒轮询check_pending_transactions
// ★ 第61批-续2:移除文件通知(跨机部署无效)
// 原逻辑:写 sync_notify.txt 文件,Java 端 checkSyncNotify() 读取
// 问题:不是所有 MC 服务器和 web 部署在同一台机器,文件不共享
// 修复:依赖 Java 端每5秒轮询 check_pending_transactions
@error_log('[notifySync] 收到同步通知,tx_id=' . $txId . ',Java轮询会自动拉取');
success(['tx_id' => (int)$txId], '已通知插件立即同步交易数据');