outlook-report-demo.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. BASE_URL="${BASE_URL:-http://localhost:8500}"
  4. ENDPOINT="${BASE_URL%/}/api/exam-sprint/outlook-reports"
  5. RESPONSE_BODY="$(mktemp)"
  6. cleanup() {
  7. rm -f "$RESPONSE_BODY"
  8. }
  9. trap cleanup EXIT
  10. http_code="$({
  11. curl -sS \
  12. -o "$RESPONSE_BODY" \
  13. -w '%{http_code}' \
  14. -X POST \
  15. -H 'Content-Type: application/json' \
  16. --data-binary @- \
  17. "$ENDPOINT" <<'JSON'
  18. {
  19. "StudentName": "20260318测试",
  20. "StudentStage": 2,
  21. "StageName": "初中",
  22. "StageVocabulary": 10,
  23. "StageExaminName": "中考",
  24. "StageImportant": 3,
  25. "StudentWordsLatest": [
  26. {
  27. "WordId": 1,
  28. "MeanId": 101,
  29. "WordSpell": "ability",
  30. "WordFrequency": 1,
  31. "Mastery": 0.9,
  32. "ReviewTimes": 4,
  33. "Reliability": 95,
  34. "CreateTime": "2026-03-18T08:00:00Z"
  35. },
  36. {
  37. "WordId": 2,
  38. "MeanId": 102,
  39. "WordSpell": "center",
  40. "WordFrequency": 3,
  41. "Mastery": 0.75,
  42. "ReviewTimes": 3,
  43. "Reliability": 88,
  44. "CreateTime": "2026-03-18T08:05:00Z"
  45. },
  46. {
  47. "WordId": 3,
  48. "MeanId": 103,
  49. "WordSpell": "father",
  50. "WordFrequency": 6,
  51. "Mastery": 0.4,
  52. "ReviewTimes": 1,
  53. "Reliability": 70,
  54. "CreateTime": "2026-03-18T08:10:00Z"
  55. },
  56. {
  57. "WordId": 4,
  58. "MeanId": 104,
  59. "WordSpell": "catch",
  60. "WordFrequency": 9,
  61. "Mastery": 0.2,
  62. "ReviewTimes": 0,
  63. "Reliability": 60,
  64. "CreateTime": "2026-03-18T08:15:00Z"
  65. }
  66. ],
  67. "MastedWordCount": 4,
  68. "UnMastedWordCount": 6,
  69. "ExamineStrangeWordCount": 3,
  70. "TestPaperWordIdArray": [1, 2, 3, 4, 5],
  71. "TestPaperTitle": "文章2.jpg",
  72. "TestPaperUnMasterWordCount": 3,
  73. "TestPaperMastedWordCount": 2,
  74. "TestPaperWordCount": 5,
  75. "Complex": false
  76. }
  77. JSON
  78. })"
  79. printf 'HTTP %s\n' "$http_code"
  80. cat "$RESPONSE_BODY"
  81. if [ "$http_code" != "202" ]; then
  82. exit 1
  83. fi