Files
ai_wht_wechat/go_backend/migrations/init_password_login.sql
2026-01-06 19:36:42 +08:00

41 lines
1.5 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.

-- 手机号密码登录 - 测试数据初始化脚本
-- 为测试用户设置密码(使用 SHA256 加密)
-- 常用密码哈希值SHA256
-- admin123: 240be518fabd2724ddb6f04eeb1da5967448d7e831c08c8fa822809f74c720a9
-- user123: e606e38b0d8c19b24cf0ee3808183162ea7cd63ff7912dbb22b5e803286b4446
-- 123456: 8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92
-- 示例1为手机号 13800138000 的用户设置密码为 123456
UPDATE ai_users
SET password = '8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92'
WHERE phone = '13800138000' AND status = 'active';
-- 示例2为手机号 13800138001 的用户设置密码为 user123
UPDATE ai_users
SET password = 'e606e38b0d8c19b24cf0ee3808183162ea7cd63ff7912dbb22b5e803286b4446'
WHERE phone = '13800138001' AND status = 'active';
-- 示例3为手机号 13800138002 的用户设置密码为 admin123
UPDATE ai_users
SET password = '240be518fabd2724ddb6f04eeb1da5967448d7e831c08c8fa822809f74c720a9'
WHERE phone = '13800138002' AND status = 'active';
-- 查询验证password 字段默认不显示,需要手动选择)
SELECT
id,
phone,
username,
real_name,
LEFT(password, 20) as password_preview,
status,
created_at
FROM ai_users
WHERE phone IN ('13800138000', '13800138001', '13800138002')
ORDER BY id;
-- 注意事项:
-- 1. 密码使用 SHA256 加密存储,不可逆
-- 2. 如需生成新密码哈希使用工具go run tools/generate_password.go [密码]
-- 3. 测试时使用明文密码登录,系统会自动验证哈希值