peixue-dev/Archive/[一次性]检查测试账号角色-2026-02-01.sql

35 lines
1.2 KiB
SQL
Raw Permalink 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.

-- 检查测试账号的角色值
-- 用于诊断分销员登录跳转到家长端的问题
SELECT
id,
phone,
real_name,
nickname,
user_type,
status,
create_time,
CASE user_type
WHEN 'user' THEN '✅ 家长(正确)'
WHEN 'parent' THEN '⚠️ 家长需要改为user'
WHEN 'teacher' THEN '✅ 陪伴员(正确)'
WHEN 'manager' THEN '✅ 管理师(正确)'
WHEN 'distributor' THEN '✅ 分销员(正确)'
WHEN 'provider' THEN '✅ 服务商(正确)'
ELSE CONCAT('❌ 未知角色: ', user_type)
END AS '角色检查'
FROM `user`
WHERE phone IN ('13800138000', '13800138001', '13800138002', '13800138003', '13800138004')
ORDER BY phone;
-- 如果发现问题使用下面的SQL修复
-- 修复家长角色如果是parent改为user
-- UPDATE `user` SET user_type = 'user' WHERE phone = '13800138000' AND user_type = 'parent';
-- 修复分销员角色如果不是distributor
-- UPDATE `user` SET user_type = 'distributor' WHERE phone = '13800138003';
-- 修复服务商角色如果不是provider
-- UPDATE `user` SET user_type = 'provider' WHERE phone = '13800138004';