2.1 版本文件

This commit is contained in:
2026-08-14 10:55:06 +08:00
commit a3434ec620
67 changed files with 12559 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
// 诊断脚本:打印当前商城实际连接的数据库 + 指定用户真实积分
// 用完请删除本文件。
if (!defined('IN_APP')) { define('IN_APP', true); }
require __DIR__ . '/includes/config.php';
require __DIR__ . '/includes/db.php';
require __DIR__ . '/includes/functions.php';
header('Content-Type: text/plain; charset=utf-8');
echo "=== 当前商城实际连接的数据库 ===\n";
echo "DB_HOST = " . DB_HOST . "\n";
echo "DB_NAME = " . DB_NAME . "\n";
echo "DB_PREFIX= " . DB_PREFIX . "\n\n";
$target = $_GET['u'] ?? 'freenw';
echo "=== 查询用户「{$target}」的真实积分(来自数据库)===\n";
$stmt = db()->prepare('SELECT id, username, is_admin, points FROM ' . tn('users') . ' WHERE username = ?');
$stmt->execute([$target]);
$rows = $stmt->fetchAll();
if (empty($rows)) {
echo "未找到用户「{$target}\n";
} else {
foreach ($rows as $r) {
echo "id=" . (int)$r['id']
. " username=" . $r['username']
. " is_admin=" . (int)$r['is_admin']
. " points=" . (int)$r['points'] . "\n";
}
// 用和前台完全相同的方式再取一次,验证 getCurrentUser 路径
$u = currentUser();
echo "\n=== 当前登录会话(currentUser===\n";
if ($u) {
echo "id=" . (int)$u['id'] . " username=" . $u['username'] . " points(对象)=" . (int)$u['points']
. " points(getUserPoints)=" . getUserPoints($u['id']) . "\n";
} else {
echo "(未登录)\n";
}
}
echo "\n提示:如果这里显示的 points 就是 900,说明数据库没错,问题在页面缓存/没上传最新代码;\n";
echo "如果这里也是 130,说明后台加的那笔积分写到了别的数据库——检查云服务器上商城自己的 config.php 的 DB_HOST。\n";