Skip to content

移动端接口文档

1. 页面登录

/**
* @path /h5/blog/auth/login
* @method POST
* @param {username, password}
*/
const result = {
data: {
id: "046f0c040c5b462092690dcc0d6755b1",
friendCount: 0,
gender: 1,
avatarUrl:
"/blog-service-oss/assets/h5/user/avatar/20240118/135d8c1f99d44fd992df49468e238972.png",
fansCount: 0,
type: 1,
nickname: "小可爱",
score: 0,
createTime: 1702525518887,
username: "hejian_test2",
ip: "",
region: "",
address: "吉林省;长春市;二道区&222",
description: "这个人很懒,什么都没有留下啥?",
token:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjA0NmYwYzA0MGM1YjQ2MjA5MjY5MGRjYzBkNjc1NWIxIiwidXNlcm5hbWUiOiJoZWppYW5fdGVzdDIiLCJ0eXBlIjoxLCJuaWNrbmFtZSI6IuWwj-WPr-eIsSIsImF2YXRhclVybCI6Ii9ibG9nLXNlcnZpY2Utb3NzL2Fzc2V0cy9oNS91c2VyL2F2YXRhci8yMDI0MDExOC8xMzVkOGMxZjk5ZDQ0ZmQ5OTJkZjQ5NDY4ZTIzODk3Mi5wbmciLCJpcCI6IiIsInJlZ2lvbiI6IiIsImFkZHJlc3MiOiLlkInmnpfnnIE76ZW_5pil5biCO-S6jOmBk-WMuiYyMjIiLCJkZXNjcmlwdGlvbiI6Iui_meS4quS6uuW-iOaHku-8jOS7gOS5iOmDveayoeacieeVmeS4i-WVpe-8nyIsImVtYWlsIjoiNTY5ODgxMDg0QHFxLmNvbSIsImlhdCI6MTcyNzMyMDU0NywiZXhwIjoxNzI3NDA2OTQ3fQ.g93_bY8UeVHjWJssxZE_hBOe9e2YUi_YnG5VA5mmJV8",
},
code: 200,
success: true,
message: "SUCCESS",
};

2. 页面退出登录

/**
* @path /h5/blog/auth/logout
* @header {authorization=[token]}
* @method POST
* @param {username, password, email}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};

3. 页面注册

/**
* @path /h5/blog/auth/register
* @method POST
* @param {gender, nickname, username, email, password, address}
*/
const result = {
data: "046f0c040c5b462092690dcc0d6755b1"
code: 200,
success: true,
message: "SUCCESS",
}

4. 页面重置密码

/**
* @path /h5/blog/auth/resetPassword
* @method POST
* @param {username}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};

5. 检查密码重置 token 是否有效

/**
* @path /h5/blog/auth/checkResetPasswordToken
* @method POST
* @param {token}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};

6. 登录页更新用户密码

/**
* @path /h5/blog/auth/updateUserPassword
* @method POST
* @param {username, password, token}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};

7. 页面获取文章列表

/**
* @path /h5/blog/post/getPostList
* @method GET
* @param {page, rowsPerPage, sortBy, sortDirection, channelId}
* @params_description sortBy 只支持 id,createTime,view,comment 排序
*/
const result = {
data: {
total: 966,
pageData: [
{
id: "df41a6b928c8400887f0551b278426ce",
title: "女人为什么喜欢涂指甲油?",
poster:
"http://cn-sy1.rains3.com:443/blog-service-oss/assets/cover_lib/cb3d62abead340bf929e72d16dfa0bfa.png",
content: "<p>因为好看呀!!</p>",
createTime: 1708876800000,
updateTime: 1727174079473,
view: 14,
postType: "1",
postTags: ["指甲", "美甲", "款式", "肤色", "持久"],
videoPoster: null,
videoUrl: null,
galleries: null,
srcTopicId: "df41a6b928c8400887f0551b278426ce",
shelveTimeStart: 1709004581000,
shelveTimeEnd: 1740540581000,
authorId: "efede100a30c4cea9a84680c075950d1",
directoryId: "4489552b7aa14017bd287470c59db93c",
channelId: "4ed7f0d8b621c8ccf9e11eca9991d6dc",
pinned: "0",
recommended: "0",
hot: "0",
original: "0",
paid: "0",
free: "1",
carousel: "0",
political: "0",
privated: "0",
publiced: "1",
comment: 0,
channel: {
id: "4ed7f0d8b621c8ccf9e11eca9991d6dc",
name: "热帖",
},
author: {
id: "efede100a30c4cea9a84680c075950d1",
name: "jenhe",
followCount: 0,
type: 1,
avatarUrl:
"http://cn-sy1.rains3.com:443/blog-service-oss/assets/post-author/3f717cf342434fe9b903d196d35494b6.png",
fansCount: 0,
nick: "何健",
score: 0,
description: "miaoshu",
coverUrl:
"http://cn-sy1.rains3.com:443/blog-service-oss/assets/post-author/e5efb2a41cfa42aa8b917adb8af087c9.jpeg",
},
directory: {
id: "4489552b7aa14017bd287470c59db93c",
name: "天天新闻",
subName: "https://tititxt.com/",
type: 0,
parent_id: "383622c55f1643ab977aef886a7bc53e",
},
survey: [],
},
],
},
};

8. 获取 home 栏下头部的文章,轮播文章,和政治置顶文章

/**
* @path /h5/blog/post/getHomeHeadPost
* @method GET
*/
const result = {
data: {
carouselData: [
/* 同上 */
],
politicalData: [
/* 同上 */
],
},
code: 200,
success: true,
message: "SUCCESS",
};

9. 获取热门

/**
* @path /h5/blog/post/getHotTop
* @method GET
* @param {page, rowsPerPage}
*/
const result = {
data: {
newsData: [
/* 同上 */
],
authorData: [
{
id: "5ba1a83e33cf47d182b98ac1fe1beac8",
name: "hejian",
followCount: 0,
type: 1,
status: 0,
avatarUrl:
"http://cn-sy1.rains3.com:443/blog-service-oss/assets/post-author/668dc0b4aabe4085ba38a4943c706ed3.png",
articleCount: 0,
fansCount: 0,
nick: "hejian呀",
score: 0,
createTime: 1681787178125,
updateTime: 1685412473296,
loginTime: null,
description: "何健的个人账号",
coverUrl:
"http://cn-sy1.rains3.com:443/blog-service-oss/assets/post-author/b64c3b075e3e4028865d908b7cf77da4.png",
posts: 645,
},
],
commentData: [
{
id: "7d81240ed972444ab1fb68b953b551b3",
id2: "46d9b30627d9415f8e7180ba3b1a15d5",
topId: null,
content: "2",
postId: "10604644",
userId: "3a4d1e4777c34b328eb46b0a701e0d08",
replyId: null,
postTime: 1686279455351,
status: 1,
like: 1,
unlike: 1,
user: {
id: "3a4d1e4777c34b328eb46b0a701e0d08",
gender: 1,
avatarUrl: "http://localhost:3000/cdn/avatar/Malphite.png",
nickname: "何健的账号",
username: "hejian_test",
},
post: {
/* 同上 */
},
},
],
},
code: 200,
success: true,
message: "SUCCESS",
};

10. 获取轮播图新闻

/**
* @path /h5/blog/post/getCarouselPost
* @method GET
*/
const result = {
data: {
pageData: [
/* 同上 */
],
},
code: 200,
success: true,
message: "SUCCESS",
};

11. 获取所有频道

getAllChannel get

/**
* @path /h5/blog/channel/getAllChannel
* @method GET
*/
const result = {
data: {
pageData: [
{
id: "259a771f1c531f64fe0591697781c986",
name: "测试专用版面",
},
...
],
},
code: 200,
success: true,
message: "SUCCESS",
};

12. 获取所有分类,树形结构

/**
* @path /h5/blog/channel/getAllDirectory
* @method GET
*/
const result = {
data: {
id: "12af235486fde6684e4b9e83f5d2b779",
name: "文化人文",
cover: "",
description: "社科/文学",
children: [
{
id: "03f0df9250262415dc81bf46e7e817e0",
name: "旅行",
subName: "Travels",
type: 1,
parent_id: "12af235486fde6684e4b9e83f5d2b779",
children: [
{
id: "9138dd29bc4c18ee77451c88d67d0fbe",
name: "大香格里拉·康青藏高原",
subName: "ShangriLa",
type: 0,
parent_id: "03f0df9250262415dc81bf46e7e817e0",
},
{
id: "a07729a733a076883ab5c99fcfb82768",
name: "山野穿越",
subName: "Trekking",
type: 0,
parent_id: "03f0df9250262415dc81bf46e7e817e0",
},
],
},
{
id: "0815edae72154a2780d4b72a7d56e1e4",
name: "其他",
subName: "其他",
type: 0,
parent_id: "12af235486fde6684e4b9e83f5d2b779",
children: [],
},
],
},
code: 200,
success: true,
message: "SUCCESS",
};

13. 页面搜索

/**
* @path /h5/blog/post/search
* @method GET
* @param {keyword, page, type, rowsPerPage}
* @params_description type是post,author,user
*/
const post_result = {
data: {
list: [
/* 同上 */
],
},
code: 200,
success: true,
message: "SUCCESS",
};
const author_result = {
data: {
list: [
{
id: "eefefb0cde054f69bf032042594ccac8",
name: "hejian2",
followCount: 0,
type: 0,
avatarUrl:
"http://cn-sy1.rains3.com:443/blog-service-oss/assets/post-author/9248ff1af7984431a6bacdf49bf2fc2b.png",
fansCount: 0,
nick: "hejian2呀",
score: 0,
description: "qiye",
coverUrl:
"http://cn-sy1.rains3.com:443/blog-service-oss/assets/post-author/f00b205add88435ca2cd3202d61e461e.png",
},
],
},
code: 200,
success: true,
message: "SUCCESS",
};
const user_result = {
data: {
list: [
{
id: "d756c3184d924937b901e65e82752aac",
friendCount: 0,
gender: 1,
avatarUrl:
"/blog-service-oss/assets/h5/user/avatar/20240118/076d60b3cd504ca191be019944b7aa0f.png",
articleCount: 0,
fansCount: 0,
type: 1,
nickname: "hejian_test3 的昵称",
score: 0,
loginTime: null,
createTime: 1705566703531,
username: "hejian_test3",
region: "",
address: "天津市;河东区&",
description: "这个人很懒,什么都没有留下",
},
],
},
code: 200,
success: true,
message: "SUCCESS",
};

14. 获取没有 poster 的文章

/**
* @path /h5/blog/post/getAuthorEssay
* @method GET
* @param {page, rowsPerPage}
*/
const result = {
data: {
list: [
/* 同上 */
],
},
code: 200,
success: true,
message: "SUCCESS",
};

15. 获取文章的一级评论

/**
* @path /h5/blog/comment/getPostLevel1CommentsById
* @method GET
* @param {id, rowsPerPage, page}
*/
const result = {
data: {
total: 521,
pageData: [
{
id: "f5b76812a23444c8ad04fbf7630c5acb",
id2: "cb93ba2a823e298b5544f20ab7ee363a",
content:
"个人观点,当然要“管”孩子,但是要注意“管”的方式,具体针对你的孩子,我觉得你也许应该思考一下娃妈的意见,我个人觉得她的话有一定道理。你应该继续关心他,关注他,",
postId: "b97f9e3412b93a06a846ba779b52cfbe",
userId: "c2ab38dd81e148ec9f02760ceaada40b",
replyId: null,
status: 1,
postTime: 1683862022000,
like: 0,
unlike: 0,
topId: null,
account: {
id: "c2ab38dd81e148ec9f02760ceaada40b",
ip: "103.126.24.17",
type: 1,
score: 0,
gender: 0,
region: "Hong Kong;Wanchai",
address: "陕西省;西安市;鄠邑区;草堂街道&宋村",
nickname: "你好",
username: "KEqcI",
avatarUrl: "http://localhost:3000/cdn/avatar/Milio.png",
fansCount: 0,
loginTime: null,
createTime: 1685948231418,
description: "真棒",
friendCount: 0,
articleCount: 0,
},
childCommentCount: 0,
},
],
},
};

16. 获取文章的二级评论

/**
* @path /h5/blog/comment/getPostLevel2CommentsById
* @method GET
* @param {id, rowsPerPage, page}
*/
const result = {
data: {
pageData: [
{
id: "c5823ea2ca9f43b6b8dcc21268671239",
id2: "8b207b0952d43114b7fa395d28d222c3",
content: "。123123123123",
postId: "b97f9e3412b93a06a846ba779b52cfbe",
userId: "92b4543d43964e038c19c9737e30d9c9",
replyId: "f955f71558fb966e15e933750ef6e066",
status: 1,
postTime: 1683731679000,
like: 0,
unlike: 0,
topId: "a7a49726027c2b0600875ec4e1038ba2",
account: {
id: "92b4543d43964e038c19c9737e30d9c9",
ip: "103.126.24.17",
type: 1,
score: 0,
gender: 1,
region: "Hong Kong;Wanchai",
address: "湖北省;鄂州市;梁子湖区;梁子镇&33",
nickname: "333",
username: "JmJOs",
avatarUrl: "http://localhost:3000/cdn/avatar/Aphelios.png",
fansCount: 0,
loginTime: null,
createTime: 1685700976959,
description: "333",
friendCount: 0,
articleCount: 0,
},
},
],
code: 200,
success: true,
message: "SUCCESS",
},
};

17. 获取作者的所有文章

/**
* @path /h5/blog/post/getPostListByAuthorId
* @method GET
* @param {id, page, rowsPerPage}
*/
const result = {
data: {
total: 645,
pageData: [
{
id: "4bdbcfc9e5bf47e7919ac67d2a77a510",
title: "何黄淼针灸入门一夜通",
poster: "",
createTime: 1709136000000,
view: 10,
comment: 0,
authorId: "5ba1a83e33cf47d182b98ac1fe1beac8",
directoryId: "4489552b7aa14017bd287470c59db93c",
channelId: "db0bbb22ae11a11c352110e2cf31ce41",
postType: "1",
},
],
},
code: 200,
success: true,
message: "SUCCESS",
};

18. 获取作者详情

/**
* @path /h5/blog/author/getAuthorDetailById
* @method GET
* @param {id}
*/
const result = {
data: {
id: "5ba1a83e33cf47d182b98ac1fe1beac8",
name: "hejian",
followCount: 0,
type: 1,
status: 0,
avatarUrl:
"http://cn-sy1.rains3.com:443/blog-service-oss/assets/post-author/668dc0b4aabe4085ba38a4943c706ed3.png",
articleCount: 645,
fansCount: 0,
nick: "hejian呀",
score: 0,
createTime: 1681787178125,
description: "何健的个人账号",
coverUrl:
"http://cn-sy1.rains3.com:443/blog-service-oss/assets/post-author/b64c3b075e3e4028865d908b7cf77da4.png",
},
code: 200,
success: true,
message: "SUCCESS",
};

19. 记录文章 view 数

/**
* @path /h5/blog/post/addPostView
* @method GET
* @param {id}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};

20. 获取用户评论

/**
* @path /h5/blog/comment/getUserComments
* @method POST
* @param {id, rowsPerPage, page}
*/
const result = {
data: {
total: 5715,
pageData: [
{
id: "dd574b195e5a49d397cdec2115903556",
id2: "f25c1d19cd499fa7c796ac2079c16b28",
topId: null,
content: "d",
postId: "9aa4ea38e565220ff06c1a1c1f59de1d",
userId: "92b4543d43964e038c19c9737e30d9c9",
replyId: null,
postTime: 1686042131907,
status: 1,
like: 0,
unlike: 0,
user: {
id: "92b4543d43964e038c19c9737e30d9c9",
gender: 1,
avatarUrl: "http://localhost:3000/cdn/avatar/Aphelios.png",
nickname: "333",
username: "JmJOs",
},
post: {
/* 同上 */
},
},
],
},
code: 200,
success: true,
message: "SUCCESS",
};

21. 获取作者的文章

/**
* @path /h5/blog/post/getAuthorPost
* @method GET
* @param {id, page, rowsPerPage}
*/
const result = {
data: {
total: 645,
pageData: [
{
id: "d29e0d0320cb44d98383a864426d2b56",
title: "",
poster:
"http://cn-sy1.rains3.com:443/blog-service-oss/assets/cover_lib/8e520283ba66441583e24ffa552bed8b..jpg",
content: "123123123123123123123",
createTime: 1727173543588,
updateTime: 1727173543588,
view: 0,
postType: "1",
postTags: ["你真棒"],
videoPoster: null,
videoUrl: null,
galleries: null,
srcTopicId: "d29e0d0320cb44d98383a864426d2b56",
shelveTimeStart: 1726632000000,
shelveTimeEnd: 1729742400000,
authorId: "d4f4cc7f6e6a41da8177c91a1a4ddc10",
directoryId: "145e72e81246272cca0a610ad44edf6a",
channelId: "4ed7f0d8b621c8ccf9e11eca9991d6dc",
pinned: "0",
recommended: "0",
hot: "1",
original: "0",
paid: "0",
free: "1",
carousel: "0",
political: "0",
privated: "0",
publiced: "1",
channel: {
id: "4ed7f0d8b621c8ccf9e11eca9991d6dc",
name: "热帖",
},
author: {
id: "d4f4cc7f6e6a41da8177c91a1a4ddc10",
name: "test",
followCount: 0,
type: 1,
avatarUrl:
"http://cn-sy1.rains3.com:443/blog-service-oss/assets/post-author/4ca6a7d21d484a4fa1e65df7ffe6f729.png",
fansCount: 0,
nick: "test@123",
score: 0,
description: "1",
coverUrl:
"http://cn-sy1.rains3.com:443/blog-service-oss/assets/post-author/aa0a1430c5a943caa2ad4b9996c6d5c2.png",
},
directory: {
id: "145e72e81246272cca0a610ad44edf6a",
name: "笑话连篇",
subName: "Joke",
type: 0,
parent_id: "5b95b5de018b3e2a5a93882d37419374",
},
},
],
},
code: 200,
success: true,
message: "SUCCESS",
};

22. 获取改邮箱的验证码

/**
* @path /h5/blog/post/sendChangeEmailCode
* @method POST
* @header {authorization=[token]}
* @param {username}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};

23. 修改邮箱

/**
* @path /h5/blog/post/updateEmail
* @method POST
* @header {authorization=[token]}
* @param {email, username, code}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};

24. 更新用户 nickname

/**
* @path /h5/blog/user/updateNickName
* @method POST
* @header {authorization=[token]}
* @param {username, nickname}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};

25. 更新用户性别

/**
* @path /h5/blog/user/updateGender
* @method POST
* @header {authorization=[token]}
* @param {username, gender}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};

26. 更新用户描述

/**
* @path /h5/blog/user/updateDescription
* @method POST
* @header {authorization=[token]}
* @param {username, description}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};

27. 更新用户地址

/**
* @path /h5/blog/user/updateAddress
* @method POST
* @header {authorization=[token]}
* @param {username, address}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};

28. 更新用户头像

/**
* @path /h5/blog/user/updateAvatar
* @method POST
* @header {authorization=[token]}
* @param {username, file}
*/
const result = {
data: "http://cn-sy1.rains3.com:443/blog-service-oss/assets/h5/user/avatar/20240118/135d8c1f99d44fd992df49468e238972.png",
code: 200,
success: true,
message: "SUCCESS",
};

29. 增加评论

/**
* @path /h5/blog/comment/addPostComment
* @method POST
* @header {authorization=[token]}
* @param {content, postId}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};

30. 增加回复

/**
* @path /h5/blog/comment/replyUserComment
* @method POST
* @header {authorization=[token]}
* @param {topId, content, postId, userId, replyId}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};

31. 投票

/**
* @path /h5/blog/vote/addVote
* @method POST
* @header {authorization=[token]}
* @param {id, selectOption}
*/
const result = {
data: null,
code: 200,
success: true,
message: "SUCCESS",
};