peixue-dev/Archive/peidu-temp-files/sql/fix_review_submit_issue_2026-01-23.sql

58 lines
1.1 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
-- 数据库peixue
USE peixue;
-- 步骤1: 检查订单状态
SELECT
id,
order_no,
status,
reviewed,
user_id,
teacher_id,
student_id,
tenant_id
FROM `order`
WHERE id = 102;
-- 步骤2: 检查是否已有评价记录
SELECT * FROM review WHERE order_id = 102;
-- 步骤3: 清理旧评价记录(如果存在)
DELETE FROM review WHERE order_id = 102;
-- 步骤4: 修复订单状态
-- 确保订单状态为4已完成reviewed为0未评价
UPDATE `order`
SET
status = 4,
reviewed = 0,
user_id = 1, -- 确保user_id与登录用户匹配
teacher_id = 1, -- 确保有陪伴员ID
student_id = 1 -- 确保有学生ID
WHERE id = 102;
-- 步骤5: 验证修复结果
SELECT
id,
order_no,
status,
reviewed,
user_id,
teacher_id,
student_id
FROM `order`
WHERE id = 102;
-- 预期结果:
-- status = 4
-- reviewed = 0
-- user_id = 1
-- teacher_id = 1
-- student_id = 1
-- 步骤6: 确认review表为空
SELECT COUNT(*) as review_count FROM review WHERE order_id = 102;
-- 预期结果review_count = 0