prepare('SELECT password FROM users WHERE id = ?'); $stmt->execute([getCurrentUserId()]); $stored = $stmt->fetchColumn(); if (!password_verify($oldPwd, $stored)) { $pwdMsg = '当前密码错误'; } else { $hash = password_hash($newPwd, PASSWORD_DEFAULT); $stmt = $pdo->prepare('UPDATE users SET password = ? WHERE id = ?'); $stmt->execute([$hash, getCurrentUserId()]); $_SESSION['flash_msg'] = '密码修改成功'; $_SESSION['flash_type'] = 'success'; header('Location: index.php'); exit; } } } $pageTitle = '首页'; require __DIR__ . '/includes/header.php'; // 统计数据 $stats = []; $pid = getCurrentProductId(); // 总兑换码数量 $stmt = $pdo->prepare('SELECT COUNT(*) as total FROM redemption_codes WHERE product_id = ?'); $stmt->execute([$pid]); $stats['total_codes'] = $stmt->fetch()['total']; // 已领取数量 $stmt = $pdo->prepare('SELECT COUNT(*) as total FROM redemption_codes WHERE status = 2 AND product_id = ?'); $stmt->execute([$pid]); $stats['claimed_codes'] = $stmt->fetch()['total']; if (isAdmin()) { $stmt = $pdo->prepare('SELECT COUNT(*) as total FROM claim_records WHERE product_id = ?'); $stmt->execute([$pid]); $stats['total_records'] = $stmt->fetch()['total']; $stmt = $pdo->prepare('SELECT COUNT(*) as total FROM work_orders WHERE product_id = ?'); $stmt->execute([$pid]); $stats['total_orders'] = $stmt->fetch()['total']; $stmt = $pdo->prepare("SELECT COUNT(*) as total FROM work_orders WHERE status = '未处理' AND product_id = ?"); $stmt->execute([$pid]); $stats['pending_orders'] = $stmt->fetch()['total']; $stmt = $pdo->query('SELECT COUNT(*) as total FROM users'); $stats['total_users'] = $stmt->fetch()['total']; } else { $stmt = $pdo->prepare('SELECT COUNT(*) as total FROM claim_records WHERE user_id = ? AND product_id = ?'); $stmt->execute([getCurrentUserId(), $pid]); $stats['my_records'] = $stmt->fetch()['total']; $stmt = $pdo->prepare('SELECT COUNT(*) as total FROM work_orders WHERE creator_id = ? AND product_id = ?'); $stmt->execute([getCurrentUserId(), $pid]); $stats['my_orders'] = $stmt->fetch()['total']; } ?>
总兑换码
已领取
领取记录
/
待处理工单/总数
用户数
我的领取记录
我的工单

快速入口

领取兑换码 发起工单 查询兑换码 领取记录 账单管理 工单记录 库存管理 工单管理 后台设置
修改密码