Sync
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled

This commit is contained in:
Yaojia Wang
2025-11-08 18:13:48 +01:00
parent 48a8431e4f
commit b11c6447b5
48 changed files with 15754 additions and 10133 deletions

52
register-test-user.ps1 Normal file
View File

@@ -0,0 +1,52 @@
# ColaFlow 测试用户注册脚本
# 创建一个测试租户和管理员账号
$apiUrl = "http://localhost:5167"
Write-Host "🚀 正在注册测试租户和用户..." -ForegroundColor Cyan
# 注册租户
$registerPayload = @{
companyName = "测试公司"
slug = "testcompany"
ownerEmail = "admin@test.com"
ownerPassword = "Admin@123456"
ownerFullName = "测试管理员"
} | ConvertTo-Json
try {
$response = Invoke-RestMethod -Uri "$apiUrl/api/tenants/register" -Method Post -Body $registerPayload -ContentType "application/json"
Write-Host "✅ 注册成功!" -ForegroundColor Green
Write-Host ""
Write-Host "📋 测试账号信息:" -ForegroundColor Yellow
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -ForegroundColor Yellow
Write-Host "租户 Slug: testcompany" -ForegroundColor White
Write-Host "邮箱: admin@test.com" -ForegroundColor White
Write-Host "密码: Admin@123456" -ForegroundColor White
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -ForegroundColor Yellow
Write-Host ""
Write-Host "🌐 访问地址:" -ForegroundColor Cyan
Write-Host "前端: http://localhost:3000" -ForegroundColor White
Write-Host "API: http://localhost:5167" -ForegroundColor White
Write-Host ""
Write-Host "返回数据:" -ForegroundColor Gray
$response | ConvertTo-Json -Depth 5
} catch {
$statusCode = $_.Exception.Response.StatusCode.value__
$errorBody = $_.ErrorDetails.Message
if ($statusCode -eq 400) {
Write-Host "⚠️ 租户可能已存在,尝试登录..." -ForegroundColor Yellow
Write-Host ""
Write-Host "📋 使用以下账号登录:" -ForegroundColor Yellow
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -ForegroundColor Yellow
Write-Host "租户 Slug: testcompany" -ForegroundColor White
Write-Host "邮箱: admin@test.com" -ForegroundColor White
Write-Host "密码: Admin@123456" -ForegroundColor White
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -ForegroundColor Yellow
} else {
Write-Host "❌ 注册失败:$errorBody" -ForegroundColor Red
}
}