outlook-report-demo.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. "StudentVocabulary": 4,
  24. "StageExaminName": "中考",
  25. "StageImportant": 3,
  26. "StudentWordsLatest": [
  27. {
  28. "WordId": 1,
  29. "MeanId": 101,
  30. "WordSpell": "ability",
  31. "WordFrequency": 1,
  32. "Mastery": 0.9,
  33. "ReviewTimes": 4,
  34. "Reliability": 95,
  35. "CreateTime": "2026-03-18T08:00:00Z"
  36. },
  37. {
  38. "WordId": 2,
  39. "MeanId": 102,
  40. "WordSpell": "center",
  41. "WordFrequency": 3,
  42. "Mastery": 0.75,
  43. "ReviewTimes": 3,
  44. "Reliability": 88,
  45. "CreateTime": "2026-03-18T08:05:00Z"
  46. },
  47. {
  48. "WordId": 3,
  49. "MeanId": 103,
  50. "WordSpell": "father",
  51. "WordFrequency": 6,
  52. "Mastery": 0.4,
  53. "ReviewTimes": 1,
  54. "Reliability": 70,
  55. "CreateTime": "2026-03-18T08:10:00Z"
  56. },
  57. {
  58. "WordId": 4,
  59. "MeanId": 104,
  60. "WordSpell": "catch",
  61. "WordFrequency": 9,
  62. "Mastery": 0.2,
  63. "ReviewTimes": 0,
  64. "Reliability": 60,
  65. "CreateTime": "2026-03-18T08:15:00Z"
  66. }
  67. ],
  68. "MastedWordCount": 4,
  69. "UnMastedWordCount": 6,
  70. "ExamineStrangeWordCount": 3,
  71. "TestPaperWordIdArray": [1, 2, 3, 4, 5],
  72. "TestPaperTitle": "文章2.jpg",
  73. "TestPaperUnMasterWordCount": 3,
  74. "TestPaperMastedWordCount": 2,
  75. "TestPaperWordCount": 5,
  76. "Complex": false
  77. }
  78. JSON
  79. })"
  80. printf 'HTTP %s\n' "$http_code"
  81. cat "$RESPONSE_BODY"
  82. if [ "$http_code" != "202" ]; then
  83. exit 1
  84. fi