peixue-dev/Archive/peidu-temp-files/sql/🔍诊断支付失败-2026-01-23.sql

60 lines
1.8 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 🔍 诊断支付失败问题 - 2026-01-23
-- 检查订单320的详细信息和钱包状态
-- 1. 检查订单信息
SELECT
id,
order_no AS '订单号',
user_id AS '用户ID',
service_type AS '服务类型',
pay_amount AS '支付金额',
status AS '订单状态',
pay_status AS '支付状态',
pay_type AS '支付方式',
pay_time AS '支付时间',
created_time AS '创建时间'
FROM `order`
WHERE id = 320;
-- 2. 检查钱包表是否存在
SHOW TABLES LIKE 'wallet';
-- 3. 检查用户钱包信息假设用户ID从订单中获取
SELECT
w.id AS '钱包ID',
w.user_id AS '用户ID',
w.balance AS '余额',
w.frozen_amount AS '冻结金额',
w.total_recharge AS '累计充值',
w.total_consume AS '累计消费',
w.total_withdraw AS '累计提现',
w.version AS '版本号',
w.created_time AS '创建时间'
FROM wallet w
WHERE w.user_id = (SELECT user_id FROM `order` WHERE id = 320);
-- 4. 检查钱包交易记录表是否存在
SHOW TABLES LIKE 'wallet_transaction';
-- 5. 检查该用户的钱包交易记录
SELECT
id,
user_id AS '用户ID',
order_id AS '订单ID',
transaction_type AS '交易类型',
amount AS '金额',
balance_before AS '交易前余额',
balance_after AS '交易后余额',
transaction_no AS '交易流水号',
status AS '状态',
remark AS '备注',
created_time AS '创建时间'
FROM wallet_transaction
WHERE user_id = (SELECT user_id FROM `order` WHERE id = 320)
ORDER BY created_time DESC
LIMIT 10;
-- 6. 如果钱包表不存在,显示提示
SELECT '⚠️ 如果上面的查询显示钱包表不存在,需要先执行钱包表创建脚本' AS '提示';
SELECT '📋 执行脚本: peidu/sql/create_wallet_tables_fixed_2026-01-23.sql' AS '解决方案';