You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
2.0 KiB
48 lines
2.0 KiB
# 测试角色管理API分页功能 |
|
Write-Host "🔍 测试角色管理API分页功能..." -ForegroundColor Green |
|
|
|
# 测试获取角色列表(第1页,每页10条) |
|
Write-Host "`n📋 测试获取角色列表(第1页,每页10条)..." -ForegroundColor Yellow |
|
$response1 = Invoke-RestMethod -Uri "http://localhost:8080/auth/roles?page=1&pageSize=10" -Method GET -Headers @{ |
|
"Authorization" = "Bearer your-token-here" |
|
"Content-Type" = "application/json" |
|
} -ErrorAction SilentlyContinue |
|
|
|
if ($response1) { |
|
Write-Host "✅ 响应成功:" -ForegroundColor Green |
|
Write-Host " Code: $($response1.code)" |
|
Write-Host " Message: $($response1.message)" |
|
if ($response1.data) { |
|
Write-Host " Data:" -ForegroundColor Cyan |
|
Write-Host " Total: $($response1.data.total)" |
|
Write-Host " Page: $($response1.data.page)" |
|
Write-Host " Size: $($response1.data.size)" |
|
Write-Host " Records: $($response1.data.data.Count)" |
|
} |
|
} else { |
|
Write-Host "❌ 请求失败或没有响应" -ForegroundColor Red |
|
} |
|
|
|
# 测试获取角色列表(第2页,每页5条) |
|
Write-Host "`n📋 测试获取角色列表(第2页,每页5条)..." -ForegroundColor Yellow |
|
$response2 = Invoke-RestMethod -Uri "http://localhost:8080/auth/roles?page=2&pageSize=5" -Method GET -Headers @{ |
|
"Authorization" = "Bearer your-token-here" |
|
"Content-Type" = "application/json" |
|
} -ErrorAction SilentlyContinue |
|
|
|
if ($response2) { |
|
Write-Host "✅ 响应成功:" -ForegroundColor Green |
|
Write-Host " Code: $($response2.code)" |
|
Write-Host " Message: $($response2.message)" |
|
if ($response2.data) { |
|
Write-Host " Data:" -ForegroundColor Cyan |
|
Write-Host " Total: $($response2.data.total)" |
|
Write-Host " Page: $($response2.data.page)" |
|
Write-Host " Size: $($response2.data.size)" |
|
Write-Host " Records: $($response2.data.data.Count)" |
|
} |
|
} else { |
|
Write-Host "❌ 请求失败或没有响应" -ForegroundColor Red |
|
} |
|
|
|
Write-Host "`n🔍 测试完成!" -ForegroundColor Green
|
|
|