test_correct.ps1 1.1 KB

1234567891011121314151617181920212223242526272829
  1. # Login
  2. $loginBody = '{"username":"admin","password":"admin123","tenantCode":"T202605253515"}'
  3. $resp = Invoke-RestMethod -Uri 'http://localhost:8006/login' -Method POST -Body $loginBody -Headers @{'Content-Type'='application/json; charset=utf-8'}
  4. $token = $resp.token
  5. $authHeaders = @{'Authorization'="Bearer $token"; 'tenant-code'='T202605253515'; 'X-Frontend-Type'='company'}
  6. # Test correct paths (matching what frontend actually calls)
  7. $correctPaths = @(
  8. '/index/statistics/rechargeComsumption',
  9. '/index/statistics/trafficLog',
  10. '/index/statistics/smsBalance',
  11. '/index/statistics/dealerAggregated',
  12. '/crm/statistics/customer',
  13. '/his/redPacket/list',
  14. '/store/storeStatistics/list',
  15. '/store/store/statistics/storeOrder'
  16. )
  17. foreach ($p in $correctPaths) {
  18. try {
  19. $r = Invoke-WebRequest -Uri "http://localhost:8006$p" -Method GET -Headers $authHeaders -UseBasicParsing -TimeoutSec 5 -ErrorAction Stop
  20. $body = $r.Content | ConvertFrom-Json
  21. Write-Output "OK $p -> code=$($body.code)"
  22. } catch {
  23. $statusCode = 0
  24. if ($_.Exception.Response) { $statusCode = [int]$_.Exception.Response.StatusCode }
  25. Write-Output "$statusCode $p"
  26. }
  27. }