quick_check.ps1 1.1 KB

1234567891011121314151617181920
  1. $ErrorActionPreference = "SilentlyContinue"
  2. [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  3. $body = '{"username":"admin","password":"admin123","tenantCode":"T202605253515"}'
  4. $resp = Invoke-WebRequest -Uri 'http://localhost:8006/login' -Method POST -ContentType 'application/json' -Body $body -UseBasicParsing -TimeoutSec 10
  5. $json = $resp.Content | ConvertFrom-Json
  6. $token = $json.token
  7. $headers = @{ 'Authorization' = "Bearer $token" }
  8. # Quick test
  9. $tests = @('/his/store/list', '/his/doctor/list', '/his/user/list', '/course/courseDomainName/list', '/crm/customer/list', '/live/coupon/list', '/qw/externalContact/list', '/company/company/list')
  10. foreach ($url in $tests) {
  11. try {
  12. $r = Invoke-WebRequest -Uri "http://localhost:8006$url" -Method GET -Headers $headers -UseBasicParsing -TimeoutSec 5
  13. Write-Output "200|GET|$url"
  14. } catch {
  15. $err = $_.Exception.Message
  16. if ($err -match '404') { Write-Output "404|GET|$url" }
  17. else { if ($err -match '(\d{3})') { $c = $Matches[1] } else { $c = 'ERR' }; Write-Output "$c|GET|$url" }
  18. }
  19. }