test_comprehensive2.ps1 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # Comprehensive endpoint test with UseBasicParsing
  2. $loginBody = @{
  3. tenantCode = "T202605253515"
  4. username = "admin"
  5. password = "admin123"
  6. } | ConvertTo-Json
  7. $resp = Invoke-RestMethod -Uri "http://localhost:8006/login" -Method POST -ContentType "application/json" -Body $loginBody
  8. $token = $resp.token
  9. $headers = @{ Authorization = "Bearer $token" }
  10. Write-Output "=== Testing all endpoints on fs-company (8006) ==="
  11. Write-Output ""
  12. $endpoints = @(
  13. "/chat/chatMsg/list",
  14. "/chat/chatMsgLogs/list",
  15. "/chat/chatSession/list",
  16. "/chat/chatGroup/list",
  17. "/chat/chatLabel/list",
  18. "/chat/chatAutoSign/list",
  19. "/chat/chatAutoSignLog/list",
  20. "/chat/chatMaterial/list",
  21. "/chat/chatMaterialCategory/list",
  22. "/qw/qwGroupLiveCode/list",
  23. "/qw/qwCustomerLink/list",
  24. "/qw/qwDrainageLink/list",
  25. "/qw/qwTag/list",
  26. "/qw/qwTagGroup/list",
  27. "/qw/qwContactWay/list",
  28. "/qw/qwContactWayLog/list",
  29. "/qw/qwBatchContact/list",
  30. "/qwSop/sop/list",
  31. "/qwSop/sopLog/list",
  32. "/qwSop/sopUser/list",
  33. "/qwSop/sopUserLogsWx/list",
  34. "/his/redPacket/info",
  35. "/his/integralGoods/list",
  36. "/his/integralOrder/list",
  37. "/his/tongue/list",
  38. "/his/healthRecord/list",
  39. "/his/medicineReport/list",
  40. "/his/inquiryReport/list",
  41. "/his/exportTask/list",
  42. "/store/storeStatistics/list",
  43. "/store/collection/list",
  44. "/store/store/list",
  45. "/store/store/storeOrderOffline/list",
  46. "/store/store/storeOrderAudit/list",
  47. "/store/store/statistics/list",
  48. "/store/store/integralGoods/list",
  49. "/store/store/integralOrder/list",
  50. "/store/store/fsStorePay/list",
  51. "/index/statistics/rechargeComsumption",
  52. "/index/statistics/trafficLog",
  53. "/crm/statistics/customer",
  54. "/billing/wallet/list",
  55. "/billing/walletLog/list",
  56. "/transfer/transfer/list",
  57. "/transfer/voiceLog/list",
  58. "/course/courseDomainName/list",
  59. "/course/courseQuestionBank/list",
  60. "/course/courseAnswerLog/list",
  61. "/course/courseRedPacketLog/list",
  62. "/device/list",
  63. "/watch/deviceStatus/list"
  64. )
  65. foreach ($path in $endpoints) {
  66. try {
  67. $r = Invoke-WebRequest -Uri "http://localhost:8006$path" -Method GET -Headers $headers -UseBasicParsing -ErrorAction Stop
  68. $body = $r.Content | ConvertFrom-Json
  69. $code = $body.code
  70. $msg = $body.msg
  71. if ($code -eq 200) {
  72. Write-Output "OK $path => code=$code"
  73. } else {
  74. $shortMsg = if ($msg.Length -gt 50) { $msg.Substring(0,50) } else { $msg }
  75. Write-Output "ERR $path => code=$code msg=$shortMsg"
  76. }
  77. } catch {
  78. $status = $_.Exception.Response.StatusCode.value__
  79. if ($status -eq 404) {
  80. Write-Output "404 $path => NOT FOUND"
  81. } elseif ($status -eq 405) {
  82. Write-Output "405 $path => Method Not Allowed"
  83. } else {
  84. Write-Output "ERR $path => HTTP $status"
  85. }
  86. }
  87. }