课设接口----

用户

请求地址

http://124.223.6.87:8084/SpringBlogs/user

根据action属性的值,处理不同事件

<input type="hidden" name="action" value="login">
注册--regist
登陆--login
查询--queryAllUser
删除--deleteUser
注销
{
	"data":    "所需要的数据",
	"msg":     "提示信息",
	"errCode":    "错误类型,成功为0,失败为-1"
}

游客

参数类型
actionStringvisitor

请求会返回一个标志此游客的token,
之后的每个请求都携带此token
只有浏览的权限

失败:

{
	"msg": "访问失败",
	"errCode": -1
}

成功

{
	"authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjI0NDciLCJsb2dpbiI6ImZhbHNlIiwiZXhwIjoxNjcwMjAxODUyLCJ1c2VybmFtZSI6Iua4uOWuojI0NDcifQ.iS1UFENVzR2LYbTon1QixgHHP0BBoe0GI05iURV0sP0",
	"msg": "游客登陆成功",
	"isLogin": false,
	"touxinag": "https://img03.scbao.com/201111/1082172-201111015F226.jpg",
	"errCode": 0,
	"username": "游客2447"
}

使用此token访问修改类接口

{
	"msg": "未登陆!",
	"errCode": "-1"
}

其他接口都可以正常访问

注册

参数类型
actionStringregist

username
填qq号 会自动获取qq网名和QQ头像
作为博客的网名跟头像

注册失败:

{
	"msg": "注册失败,用户名已存在!",
	"errCode": -1
}

注册成功

{
	"msg": "注册成功!",
	"errCode": 0
}

登陆

参数类型
actionStringlogin

登陆失败:

{
	"msg": "登陆失败,用户名或密码错误!",
	"errCode": -1
}

登陆成功:
登陆成功在响应头里面会有authorization数据 (token)
保存在客户端本地

{
	"msg": "登陆成功!",
	"errCode": 0,
	"touxiang":"x.jpg",
	"username":"name",
	"user_id":"1"
}

注销

在客户端删除当前用户token 需要重新登陆获新的token

根据id获取指定用户的信息

请求地址:http://124.223.6.87:8084/SpringBlogs/user
参数:

参数类型
actionStringqueryUser
user_idint用户id
{
	"data": [
		{
			"user_id": 1,
			"name": "用户1",
			"username": "111111111",
			"mail": "21345t4ew",
			"touxiang": "../static/touxiang.jpg"
		}
	]
}

查找所有已经注册的用户(管理员)

请求方式post
action=queryAllUser

返回包含注册人数,以及注册人的详细信息

{
	"data": [
		{
			"mail": "1@qq.com",
			"name": "※残枫★残雪※",
			"password": "eqw",
			"touxiang": "https://q2.qlogo.cn/headimg_dl?dst_uin=1193513895&spec=640",
			"user_id": 1,
			"username": "1193513895"
		}
	],
	"errCode": 0,
	"count": 1
}

删除用户(管理员)

post

用查询所得到的id值,作为参数

http://124.223.6.87:8084/SpringBlogs/user

从数据库中删除id为30的用户

{
	"data": "删除成功!",
	"errCode": 0
}

删除失败

{
	"data": "删除失败!",
	"errCode": -1
}

图片验证码(get请求)

大小:250*60

get请求

http://124.223.6.87:8084/SpringBlogs/yzm.jpg

每次请求都是不同的jpg

在这里插入图片描述

文章

文章是否是当前登陆用户的

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数:

参数类型
actionStringisMyArt
Art_idint文章id
{
	"msg": "是当前用户的文章",
	"isMy": true,
	"errorCode": 0
}

所有文章数量

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数:

参数类型
actionStringallArtCount
{
	"data": 5,
	"errCode": 0
}

展示指定页文章(默认主页)

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数:

参数类型
actionStringAllArt
pageint页数
{
	"data": [
		{
			"article_id": 23,
			"user_id": 1,
			"name": "娃哈哈",
			"touxiang": "../static/touxiang.jpg",
			"title": "力扣题解",
			"createTime": "2022-11-21 17:37:15",
			"descr": "数组简单操作",
			"zan": 99, //赞
			"contents": "[题目链接]: https://leetcode.cn/problems/partition-array-into-disjoint-intervals/\n\n给定一个数组 nums ,将其划分为两个连续子数组 left 和 right, 使得:\n\nleft 中的每个元素都小于或等于 right 中的每个元素。\nleft 和 right 都是非",
			"tagCount": 2,
			"tags": [
				{
					"tag_name": "算法"
				},
				{
					"tag_name": "数组"
				}
			]
		},
		{
			"article_id": 22,
			"user_id": 1,
			"name": "娃哈哈",
			"touxiang": "../static/touxiang.jpg",
			"title": "111111",
			"createTime": "2022-11-21 16:34:09",
			"descr": "文章描述",
			"zan": 0,
			"contents": "文章内容1111",
			"tagCount": 0
		},
		{
			"article_id": 21,
			"user_id": 1,
			"name": "娃哈哈",
			"touxiang": "../static/touxiang.jpg",
			"title": "最新文章777",
			"createTime": "2022-11-21 16:31:10",
			"descr": "文章描述",
			"zan": 3,
			"contents": "文章内容的的大苏打的",
			"tagCount": 0
		}
	],
	"errCode": 0,
	"count": 3
}

根据文章id获取文章所有信息

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringfindById
article_idint文章id

成功:

{
	"msg": "获取成功",
	"data": [
		{
			"article_id": 1,
			"user_id": 7,
			"name": "用户",
			"touxiang": "../static/touxiang.jpg",
			"title": "图片测试",
			"createTime": "2022-11-15 19:44:56",
			"contents": "\n![Screenshot_20210416_094242_com.lemon.lv_edit_3848.jpg](1)",
			"tagCount":0
		}
	],
	"errorCode": 0
}

失败:

{
	"msg": "文章已被删除!",
	"errorCode": -1
}

热门文章

返回10篇 赞数量最多的文章

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringhot

成功:

{
	"msg": "获取成功",
	"data": [
		{
			"article_id": 29,
			"title": "QQ标题",
			"descr": "描述",
			"zan": 32
		},
		{
			"article_id": 1,
			"title": "aaaaaaaaaaaa",
			"descr": "2345",
			"zan": 12
		},
		{
			"article_id": 2,
			"title": "测试博客2",
			"descr": "第2篇文章",
			"zan": 4
		},
		{
			"article_id": 27,
			"title": "xxx",
			"descr": "zzz",
			"zan": 1
		},
		{
			"article_id": 8,
			"title": "测试博客",
			"descr": "删",
			"zan": 0
		}
	],
	"errorCode": 0
}

查找某一用户所有文章

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringfindAllByUser
user_idint用户id

失败

{
	"msg": "该用户没有发表文章",
	"errorCode": -1
}

成功

{
	"msg": "获取成功",
	"data": [
		{
			"article_id": 29,
			"user_id": 1,
			"name": "用户1",
			"touxiang": "../static/touxiang.jpg",
			"title": "QQ标题",
			"createTime": "2022-11-21 15:40:00",
			"descr": "描述",
			"contents": "内容",
			头像,
			网名,
			标签
		},
		{
			"article_id": 28,
			"user_id": 1,
			"name": "用户1",
			"touxiang": "../static/touxiang.jpg",
			"title": "xxx",
			"createTime": "2022-11-21 15:38:48",
			"descr": "zzz",
			"contents": "yyy"
		}
	],
	"errorCode": 0
}

搜索文章(默认第一页)

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringsearchArt
keywordString关键词
pageint页数(不传为1)
{
	"msg": "成功",
	"data": [
		{
			"article_id": 23,
			"user_id": 1,
			"name": "用户1",
			"touxiang": "../static/touxiang.jpg",
			"title": "个人博客",
			"createTime": "2022-11-16 23:58:09",
			"descr": "第15篇文章",
			"contents": "\n测试"
		},
		{
			"article_id": 23,
			"user_id": 9,
			"name": "用户",
			"touxiang": "../static/touxiang.jpg",
			"title": "个人博客",
			"createTime": "2022-11-16 23:58:09",
			"descr": "第15篇文章",
			"contents": "\n测试"
		},
		{
			"article_id": 23,
			"user_id": 10,
			"name": "※残枫★残雪※",
			"touxiang": "https://q2.qlogo.cn/headimg_dl?dst_uin=1193513895&spec=640",
			"title": "个人博客",
			"createTime": "2022-11-16 23:58:09",
			"descr": "第15篇文章",
			"contents": "\n测试"
		}
	],
	"errCode": 0,
	"count": 3
}

搜索结果总数

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringsearchArtCount
keywordString关键词

成功

{
	"data": 10,
	"errCode": 0
}

发布文章

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringsaveArt
titleString标题
contentsString内容
descString文章简介

失败

{
	"msg": "发布失败",
	"errorCode": -1
}

如果未登录,或者token过期

{
	"msg": "未登陆!",
	"errCode": "-1"
}

成功

{
	"msg": "发布成功",
	"errorCode": 0
}

修改文章

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringreviseArt
Art_idint文章id
titleString标题
contentsString内容
descString文章简介

失败

{
	"msg": "修改失败",
	"errorCode": -1
}

成功

{
	"msg": "修改成功",
	"errorCode": 0
}

删除文章

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringdeleteArt
Art_idint文章id

失败

{
	"msg": "删除失败",
	"errorCode": -1
}

成功

{
	"msg": "删除成功",
	"errorCode": 0
}

点赞评论

点赞(like)

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringlike
Art_idint文章id
{
	"msg": "点赞失败",
	"errorCode": -1
}

成功

{
	"msg": "点赞成功",
	"errCode": 0
}

取消点赞

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringdislike
Art_idint文章id

成功

{
	"msg": "取消点赞成功",
	"errCode": 0
}

获取点赞数量

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringlikeNum
Art_idint文章id

失败

{
	"msg": "获取失败",
	"errCode": -1
}

成功

{
	"msg": "获取成功",
	"data": 101,
	"errCode": 0
}

查询点赞状态(当前登陆中的用户)

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringlikeNum
Art_idint文章id

成功

{
	"msg": "获取成功",
	"errCode": 0,
	"status": 1  //为1就是已点赞  0是未点赞  默认为0
}

发表评论

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringaddCommand
Art_idint文章id
commandString评论内容

失败

{
	"msg": "评论失败",
	"errCode": -1
}

成功

{
	"msg": "评论成功",
	"errCode": 0
}

删除评论

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringdelComm
comm_idint评论id

失败

{
	"msg": "删除失败",
	"errCode": -1
}

成功

{
	"msg": "删除成功",
	"errCode": 0
}

回复评论

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringreplyComm
comm_idint要回复评论的id
commentString回复内容

失败

{
	"msg": "回复失败",
	"errCode": -1
}

成功

{
	"msg": "回复成功",
	"errCode": 0
}

删除回复评论

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringdelReply
rep_comm_idint回复评论的id

失败

{
	"msg": "删除失败",
	"errCode": -1
}

成功

{
	"msg": "删除成功",
	"errCode": 0
}

查询当前文章所有评论以及对评论的回复

最新的在最前

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringallCommand
Art_idint文章id

查有评论的文章

//查id为3的文章
{
	"msg": "获取成功",
	"data": [
		{
			"comm_id": 39,
			"comment": "没人回复我",
			"name": "独孤求败",
			"touxiang": "https://img2.baidu.com/it/u=2505684809,2658429579&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",
			"createTime": "2022-11-24 18:28:40",
			"replyCount": 0
		},
		{
			"comm_id": 2,
			"comment": "确实写得好啊",
			"name": "娃哈哈",
			"touxiang": "../static/touxiang.jpg",
			"createTime": "2022-11-24 17:10:55",
			"replyCount": 2,
			"replyComm": [
				{
					"comment": "对对对",
					"createTme": "2022-11-23 18:19:23",
					"name": "杜若",
					"touxiang": "https://q3.qlogo.cn/headimg_dl?dst_uin=3198949257&spec=640"
				},
				{
					"comment": "o( ̄▽ ̄)d牛逼",
					"createTme": "2022-11-23 18:19:12",
					"name": "用户4",
					"touxiang": "https://img2.baidu.com/it/u=2505684809,2658429579&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500"
				}
			]
		},
		{
			"comm_id": 1,
			"comment": "写得很好",
			"name": "LiYang",
			"touxiang": "https://q3.qlogo.cn/headimg_dl?dst_uin=1412997562&spec=640",
			"createTime": "2022-11-22 23:40:36",
			"replyCount": 2,
			"replyComm": [
				{
					"comment": "讲的特别好",
					"createTme": "2022-11-23 18:35:10",
					"name": "用户3",
					"touxiang": "https://img2.baidu.com/it/u=2505684809,2658429579&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500"
				},
				{
					"comment": "确实",
					"createTme": "2022-11-22 23:39:05",
					"name": "用户3",
					"touxiang": "https://img2.baidu.com/it/u=2505684809,2658429579&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500"
				}
			]
		}
	],
	"errCode": 0,
	"count": 3
}

查未发表评论的文章

{
	"msg": "获取成功",
	"data": [],
	"errCode": 0,
	"count": 0
}

标签

新建标签

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringcreateTag
tag_nameString标签名

失败

{
	"msg": "添加成功",
	"errCode": 0
}

成功

{
	"msg": "添加失败",
	"errCode": -1
}

删除标签

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringdeleteTag
tag_nameString标签名

失败

{
	"msg": "删除成功",
	"errCode": 0
}

成功

{
	"msg": "删除失败",
	"errCode": -1
}

展示所有标签

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringallTag
{
	"msg": "获取失败",
	"errCode": -1
}

成功

{
	"msg": "获取成功",
	"data": [
		{
			"tag_name": "教程"
		},
		{
			"tag_name": "MySQL"
		},
		{
			"tag_name": "帮助"
		}
	],
	"errCode": 0,
	"count": 3
}

查找指定文章的所有标签

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringallTagOfArt
Art_idint文章id

失败

{
	"msg": "获取失败",
	"errCode": -1
}

成功

{
	"msg": "获取成功",
	"data": [
		{
			"tag_name": "教程",
			"article_id": 2
		}
	],
	"errCode": 0,
	"count": 1
}

查找指定标签下的所有文章

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringallArtOfTag
tag_nameString标签名
pageint页数(默认为1)

失败

{
	"msg": "获取失败",
	"errCode": -1
}

成功

{
	"data": [
		{
			"article_id": 10,
			"user_id": 1,
			"name": "用户1",
			"touxiang": "../static/touxiang.jpg",
			"title": "课设接口",
			"descr": "第4篇文章",
			"createTime": "2022-11-16 20:11:18",
			"contents": "wuwuwuuwuwuuwuwfdsajof红素掉分不到赛长度为"
		},
		{
			"article_id": 2,
			"user_id": 4,
			"name": "用户",
			"touxiang": "../static/touxiang.jpg",
			"title": "测试博客2",
			"descr": "第2篇文章",
			"createTime": "2022-11-15 19:45:23",
			"contents": "博客内容2"
		},
		{
			"article_id": 1,
			"user_id": 7,
			"name": "用户",
			"touxiang": "../static/touxiang.jpg",
			"title": "图片测试",
			"descr": "第1篇文章",
			"createTime": "2022-11-15 19:44:56",
			"contents": "\n![Screenshot_20210416_094242_com.lemon.lv_edit_3848.jpg](1)"
		}
	],
	"errCode": 0,
	"count": 3
}

查找指定标签下的所有文章总数

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringallArtCountOfTag
tag_nameString标签名
{
	"data": 3,
	"errCode": 0
}

给指定文章添加指定标签

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringaddTagForArt
Art_idint文章id
tag_nameString标签名

失败

{
	"msg": "添加成功",
	"errCode": 0
}

成功

{
	"msg": "添加失败",
	"errCode": -1
}

删除指定文章的指定标签

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringdelTagForArt
Art_idint文章id
tag_nameString标签名

失败

{
	"msg": "删除失败",
	"errCode": -1
}

成功

{
	"msg": "删除成功",
	"errCode": 0
}

分类

显示所有分类名

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringshowClassify

失败

{
	"msg": "获取失败",
	"errCode": -1
}

成功

{
	"msg": "获取成功",
	"data": [
		{
			"tag_name": "教程"
		},
		{
			"tag_name": "MySQL"
		},
		{
			"tag_name": "帮助"
		}
	],
	"errCode": 0,
	"count": 3
}

展示指定分类下的文章

最新的在最前面

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringshowArtForClassify
claNameString分类名
pageString页数(默认传1 第一页)

失败

{
	"msg": "获取失败",
	"errCode": -1
}

成功

{
	"msg": "获取成功",
	"data": [
		{
			"article_id": 1,
			"name": "用户",
			"touxiang": "../static/touxiang.jpg",
			"title": "图片测试",
			"desc": "第1篇文章",
			"createTime": "2022-11-15 19:44:56",
			"contents": "\n![Screenshot_20210416_094242_com.lemon.lv_edit_3848.jpg](1)"
		},
		{
			"article_id": 2,
			"name": "用户",
			"touxiang": "../static/touxiang.jpg",
			"title": "测试博客2",
			"desc": "第2篇文章",
			"createTime": "2022-11-15 19:45:23",
			"contents": "博客内容2"
		}
	],
	"errCode": 0,
	"count": 2
}

展示指定分类下的文章总数

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringallClaNum
claNameString分类名

失败

{
	"msg": "获取失败",
	"errCode": -1
}

成功

{
	"data": 4,
	"errCode": 0
}

留言

发表留言

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringaddMessage
contentsString留言内容

成功

{
	"msg": "添加成功",
	"errCode": 0
}

查看留言

请求地址:http://124.223.6.87:8084/SpringBlogs/blogs

参数类型
actionStringviewMsg

成功

{
{
	"data": [
		{
			"name": "李文斌",
			"contents": "好啊",
			"createTime": "2022-11-27 15:22:32"
		},
		{
			"name": "呀呼",
			"contents": "哈哈",
			"createTime": "2022-11-27 15:22:33"
		},
		{
			"name": "留言",
			"contents": "你好啊",
			"createTime": "2022-11-27 15:22:34"
		},
		{
			"name": "liwenbin",
			"contents": "我是会员",
			"createTime": "2022-11-27 15:22:35"
		},
		{
			"name": "游客8074",
			"contents": "我是游客",
			"createTime": "2022-11-27 15:22:35"
		}
	],
	"errCode": 0,
	"msgCount": 5
}
}
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值