话题详情

  • 地址 GET /api/topic/:id
  • 请求类型 application/json
  • 参数
    • token: 可不传,传token返回值里会多一个这个话题是否被自己收藏,如果不填就没有这个对象
    • id: 话题id
  • 返回 Result(Map)
  1. {
  2. "code": 200,
  3. "description": "SUCCESS",
  4. "detail": {
  5. "comments": [
  6. {
  7. "id": 1,
  8. "topicId": 1,
  9. "userId": 1,
  10. "content": "modify_comment_content",
  11. "inTime": 1548992961000,
  12. "commentId": null,
  13. "upIds": "2",
  14. "username": "tomoya",
  15. "avatar": "http://localhost:8080/static/upload/avatar/tomoya/avatar.png",
  16. "layer": 0
  17. },
  18. {
  19. "id": 5,
  20. "topicId": 1,
  21. "userId": 2,
  22. "content": "@tomoya 我是第三条评论",
  23. "inTime": 1548993369000,
  24. "commentId": 1,
  25. "upIds": null,
  26. "username": "test",
  27. "avatar": "http://localhost:8080/static/upload/avatar/test/avatar.png",
  28. "layer": 1
  29. },
  30. {
  31. "id": 4,
  32. "topicId": 1,
  33. "userId": 2,
  34. "content": "我是第二条评论",
  35. "inTime": 1548993303000,
  36. "commentId": null,
  37. "upIds": null,
  38. "username": "test",
  39. "avatar": "http://localhost:8080/static/upload/avatar/test/avatar.png",
  40. "layer": 0
  41. }
  42. ],
  43. "topic": {
  44. "id": 1,
  45. "title": "我是一个话题标题",
  46. "content": "我是话题内容\n\n我还支持Markdown语法哦\n\n![](https://avatars3.githubusercontent.com/u/6915570?s=460&v=4)\n\n- 无序列表1\n- 无序列表2\n- 无序列表3\n\n1. 有序列表1\n2. 有序列表2\n3. 有序列表3\n\n| Column A | Column B | Column C |\n| -------- | -------- | -------- |\n| A1 | B1 | C1 |\n| A2 | B2 | C2 |\n| A3 | B3 | C3 |\n\n[开发俱乐部](https://17dev.club/)",
  47. "inTime": 1548992281000,
  48. "modifyTime": 1548992296000,
  49. "userId": 1,
  50. "commentCount": 4,
  51. "collectCount": 1,
  52. "view": 13,
  53. "top": false,
  54. "good": false,
  55. "upIds": null
  56. },
  57. "topicUser": {
  58. "id": 1,
  59. "username": "tomoya",
  60. "telegramName": null,
  61. "avatar": "http://localhost:8080/static/upload/avatar/tomoya/avatar.png",
  62. "email": null,
  63. "website": null,
  64. "bio": null,
  65. "score": 20,
  66. "inTime": 1548992041000,
  67. "emailNotification": false
  68. },
  69. "collect": {
  70. "topicId": 1,
  71. "userId": 2,
  72. "inTime": 1548999420000
  73. },
  74. "collects": [
  75. {
  76. "topicId": 1,
  77. "userId": 2,
  78. "inTime": 1548999420000
  79. }
  80. ],
  81. "tags": [
  82. {
  83. "id": 1,
  84. "name": "一个标签",
  85. "description": "标签描述,解释一下标签让人能更明白它的意思",
  86. "icon": "http://spring.io/img/homepage/icon-spring-boot.svg",
  87. "topicCount": 1,
  88. "inTime": 1548992281000
  89. }
  90. ]
  91. }
  92. }

发布话题

  • 地址 POST /api/topic
  • 请求类型 application/json
  • 参数
    • token
    • title: 话题标题
    • content: 话题内容(可为空)
  • 返回 Result(Topic)
  1. {
  2. "code": 200,
  3. "description": "SUCCESS",
  4. "detail": {
  5. "id": 11,
  6. "title": "222",
  7. "content": "",
  8. "inTime": 1551063711700,
  9. "modifyTime": null,
  10. "userId": 1,
  11. "commentCount": 0,
  12. "collectCount": 0,
  13. "view": 0,
  14. "top": false,
  15. "good": false,
  16. "upIds": null
  17. }
  18. }

编辑话题

  • 地址 PUT /api/topic
  • 请求类型 application/json
  • 参数
    • token
    • id: 话题ID
    • title: 话题标题
    • content: 话题内容(可为空)
  • 返回 Result(Topic)
  1. {
  2. "code": 200,
  3. "description": "SUCCESS",
  4. "detail": {
  5. "id": 11,
  6. "title": "333",
  7. "content": null,
  8. "inTime": 1551063712000,
  9. "modifyTime": 1551064039058,
  10. "userId": 1,
  11. "commentCount": 0,
  12. "collectCount": 0,
  13. "view": 0,
  14. "top": false,
  15. "good": false,
  16. "upIds": null
  17. }
  18. }

删除话题

  • 地址 DELETE /api/topic
  • 请求类型 application/json
  • 参数
    • token
    • id: 话题ID
  • 返回 Result()
  1. {
  2. "code": 200,
  3. "description": "SUCCESS",
  4. "detail": null
  5. }

点赞话题

  • 地址 GET /api/topic/:id/vote
  • 请求类型 application/json
  • 参数
    • token
    • id: 话题ID
  • 返回 Result(int) 返回点赞后当前话题的总赞数
  1. {
  2. "code": 200,
  3. "description": "SUCCESS",
  4. "detail": 1
  5. }