test_actual_paths.ps1 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # Test actual backend paths (from @RequestMapping annotations)
  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 actual backend controller paths ==="
  11. $endpoints = @(
  12. # qw controllers from com.fs.company.controller.qw
  13. "/qwGroupLiveCode/list",
  14. "/qw/tag/list",
  15. "/qw/tagGroup/list",
  16. "/qw/sop/list",
  17. "/qw/sopLogs/list",
  18. "/qw/sopTemp/list",
  19. "/qw/material/list",
  20. "/qw/materialGroup/list",
  21. "/qw/user/list",
  22. "/qw/groupMsg/list",
  23. "/qw/welcome/list",
  24. "/qw/qwSession/list",
  25. "/qw/statistic/list",
  26. "/qw/userBehaviorData/list",
  27. "/qw/userVideo/list",
  28. "/qw/qwUserVoiceLog/list",
  29. "/qwSop/sopUserLogs/list",
  30. "/qwSop/sopUserLogsInfo/list",
  31. # transfer controllers
  32. "/transfer/transfer/list",
  33. "/transfer/voiceLog/list",
  34. # billing controllers
  35. "/billing/wallet/list",
  36. "/billing/walletLog/list",
  37. # hisStore controllers
  38. "/hisStore/fsStoreStatisticsScrm/list",
  39. "/hisStore/fsStoreOrderOfflineScrm/list",
  40. "/hisStore/fsStoreOrderAuditScrm/list",
  41. "/store/store/fsStorePay/list",
  42. # course controllers (company package)
  43. "/course/courseAnswerLog/list",
  44. "/course/courseRedPacketLog/list",
  45. "/course/courseWatchLog/list"
  46. )
  47. foreach ($path in $endpoints) {
  48. try {
  49. $r = Invoke-WebRequest -Uri "http://localhost:8006$path" -Method GET -Headers $headers -UseBasicParsing -ErrorAction Stop
  50. $body = $r.Content | ConvertFrom-Json
  51. $code = $body.code
  52. $msg = if ($body.msg) { $body.msg.Substring(0, [Math]::Min(50, $body.msg.Length)) } else { "" }
  53. if ($code -eq 200) {
  54. Write-Output "OK $path => code=$code"
  55. } else {
  56. Write-Output "ERR $path => code=$code msg=$msg"
  57. }
  58. } catch {
  59. $status = $_.Exception.Response.StatusCode.value__
  60. if ($status -eq 404) {
  61. Write-Output "404 $path"
  62. } elseif ($status -eq 405) {
  63. Write-Output "405 $path => Method Not Allowed"
  64. } else {
  65. Write-Output "ERR $path => HTTP $status"
  66. }
  67. }
  68. }