获取相关主题的接口

  • 接口说明: 获取指定数量相关主题的接口,从按照 同话题阅读量排序>同分类阅读量排序>全站阅读量排序 的优先级获取的主题中随即获取指定数量的数据,有1小时缓存
  • 接口地址: /api/threads/relate/{id}
  • 请求方式: GET

请求参数

参数名称类型是否必须描述
limitint数据数量
includestring关联数据

include 可关联的数据

关联名称模型类型是否默认描述
userusersobject发表用户
firstPostpostsobject首帖
firstPost.imagesattachmentsarray首贴图片
firstPost.attachmentsattachmentsarray首贴附件
firstPost.likedUsersusersarray点赞首贴的用户
threadVideothread-videoobject主题视频
categorycategoriesobject主题分类

请求示例

返回说明

  • 成功,http 状态码: 200
  • 失败,http 状态码: 404

返回结果

关联数据模型字段释义参见请参见相应文档

返回示例

  1. {
  2. "data": {
  3. "type": "threads",
  4. "id": "1",
  5. "attributes": {
  6. "title": "",
  7. "price": "0.00",
  8. "attachment_price": "0.00",
  9. "viewCount": 28,
  10. "postCount": 4,
  11. "createdAt": "2020-02-12T16:23:29+08:00",
  12. "updatedAt": "2020-02-12T16:57:31+08:00",
  13. "isApproved": 1,
  14. "isSticky": false,
  15. "isEssence": false,
  16. "isLongArticle": false,
  17. "canViewPosts": false,
  18. "canReply": false,
  19. "canApprove": false,
  20. "canSticky": false,
  21. "canEssence": false,
  22. "canDelete": false,
  23. "canHide": false,
  24. "canFavorite": false
  25. },
  26. "relationships": {
  27. "user": {
  28. "data": {
  29. "type": "users",
  30. "id": "1"
  31. }
  32. },
  33. "firstPost": {
  34. "data": {
  35. "type": "posts",
  36. "id": "1"
  37. }
  38. }
  39. }
  40. },
  41. "included": [
  42. {
  43. "type": "users",
  44. "id": "1",
  45. "attributes": {
  46. "id": 1,
  47. "username": "username",
  48. "mobile": "mobile",
  49. "avatarUrl": "",
  50. "threadCount": 30,
  51. "followCount": 0,
  52. "fansCount": 0,
  53. "follow": null,
  54. "status": 0,
  55. "loginAt": "2020-02-13T11:42:27+08:00",
  56. "joinedAt": "2019-12-16T19:41:17+08:00",
  57. "expiredAt": "2020-02-19T18:26:52+08:00",
  58. "createdAt": "2019-12-16T19:41:17+08:00",
  59. "updatedAt": "2020-02-13T11:42:27+08:00",
  60. "canEdit": false,
  61. "canDelete": false,
  62. "canWalletPay": true,
  63. "registerReason": "",
  64. "banReason": ""
  65. }
  66. },
  67. {
  68. "type": "posts",
  69. "id": "1",
  70. "attributes": {
  71. "replyUserId": null,
  72. "content": "Chief Unbranded Str::limit($thread->firstPost->con...",
  73. "contentHtml": "Chief Unbranded Str::limit($thread->firstPost->con...",
  74. "replyCount": 0,
  75. "likeCount": 0,
  76. "createdAt": "2020-02-12T16:23:29+08:00",
  77. "updatedAt": "2020-02-12T16:23:29+08:00",
  78. "isFirst": true,
  79. "isApproved": 1,
  80. "canEdit": false,
  81. "canApprove": false,
  82. "canDelete": false,
  83. "canHide": false,
  84. "commentPosts": null,
  85. "canLike": false
  86. }
  87. }
  88. ]
  89. }