# shapoyuedu-be
**Repository Path**: Aatrox/shapoyuedu-be
## Basic Information
- **Project Name**: shapoyuedu-be
- **Description**: No description available
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 3
- **Forks**: 1
- **Created**: 2021-07-07
- **Last Updated**: 2021-07-20
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 用户
## 注册
- Request
| Method | URL |
| ------ | ---------- |
| GET | /users/reg |
```json
{
// 必要
username: "",
nickname: "",
password: "",
// 可选
gender: 1,
copyRight: 1,
phone: "",
email: "",
avatar: ""
}
```
- Response
```json
{
"state": 200
}
// 不允许重复的username
```
## 登陆
- Request
| Method | URL |
| ------ | ------------ |
| POST | /users/login |
```json
{
username: "",
password: ""
}
```
- Response
```json
{
state: 200
data: {
gender: 1,
copyRight: 1,
phone: "",
email: "",
avatar: "",
nickname: "",
}
}
```
## 修改密码
- Request
| Method | URL |
| ------ | ---------------------- |
| POST | /users/change_password |
```json
{
oldPassword: "",
newPassword: ""
}
```
- Response
```
{
state: 200
}
```
## 获取个人资料
- Request
| Method | URL |
| ------ | ---------------- |
| GET | /users/get_by_id |
```json
{}
```
- Response
```json
{
state: 200
data: {
gender: 1,
copyRight: 1,
phone: "",
email: "",
avatar: "",
nickname: "",
}
}
```
## 修改个人资料
- Request
| Method | URL |
| ------ | --------------------- |
| POST | /users/change_profile |
```json
{
gender: 1,
phone: "",
email: "",
avatar: "",
nickname: ""
}
```
- Response
```json
{
state: 200
}
```
## 修改头像
- Request
| Method | URL |
| ------ | -------------------- |
| POST | /users/change_avatar |
> 以老师讲的的方式传入
- Response
```json
{
state: 200
data: {
avatar: ""
}
}
```
## 注销用户
- Request
| Method | URL |
| ------ | ------------- |
| POST | /users/delete |
```json
{
password: ""
}
```
- Response
```
{
state: 200
}
```
# 动态
## 发布动态
- Request
| Method | URL |
| ------ | ------------ |
| POST | /posts/tweet |
```json
{
// 必要
uid: 1,
//可选
priority: 1,
title: "",
content: ""
}
```
- response
```json
{
state:200
}
```
## 所有动态
- Request
| Method | URL |
| ------ | ----------- |
| POST | /posts/page |
```json
{
// 代表当前页数
page: 1
}
```
- response
```json
{
state:200,
data: {
[
{
pid: 1,
uid: 1,
type: "shit",
title: "insert",
content: "Insert"
},
//...
]
}
}
```
## 发布动态
- Request
| Method | URL |
| ------ | ----------- |
| POST | /posts/mine |
```json
{}
```
- response
```json
{
state:200,
data: {
}
}
```
# 书籍
## 上传书籍(废弃)
- Request
| Method | URL |
| ------ | -------------------- |
| POST | /books/add_new_books |
```json
{
// 必要
title: "",
bookfile: "",
author: "",
// 可选
type:"",
imagefile: "",
description: ""
}
```
- Response
```json
{
"state": 200
}
```
## 获取书籍详情
- Request
| Method | URL |
| ------ | ------------- |
| GET | /books/detail |
```json
{}
```
- Response
```json
{
state: 200
data: {
name: "",
author: "",
intro: "",
user: "",
date: "",
img: "",
readNum: "",
location: ""
}
}
```
## 更新阅读量
- Request
| Method | URL |
| ------ | ---------------------- |
| GET | /books/update_read_num |
```json
{
bid: ""
}
```
- Response
```json
{
state: 200
data: {
readNum: ""
}
}
```
## 发布评分
- Request
| Method | URL |
| ------ | ---------------- |
| GET | /books/mark_book |
```json
{}
```
- response
```json
{
state:200,
data: {
content: ""
}
}
```
## 发布书评
- Request
| Method | URL |
| ------ | ----------- |
| POST | /posts/mine |
```json
{}
```
- response
```json
{
state:200,
data: {
}
}
```
## 获取书籍评分
- Request
| Method | URL |
| ------ | -------------------- |
| GET | /books/get_book_mark |
```json
{ bid: ""}
```
- Response
```json
{ state: 200 data: { scoreAvg: "" }}
```
## 获取书评
- Request
| Method | URL |
| ------ | ----------------------------------- |
| GET | /books/comments/get_comments_by_bid |
```json
{ bid: ""}
```
- Response
```json
{ state: 200 data: { [ img: "", name: "", content: "", date: "" ] ... }}
```
## 点赞
- Request
| Method | URL |
| ------ | ---- |
| GET | / |
```json
{}
```
- Response
```
{ state: 200}
```
## 取消点赞
- Request
| Method | URL |
| ------ | ---- |
| GET | / |
```json
{}
```
- response
```json
{ state:200}
```
## 返回书籍查找结果
- Request
| Method | URL |
| ------ | ----------- |
| POST | /posts/mine |
```json
{}
```
- response
```json
{ state:200, data: { [ name: "", author: "", image: "", description: "" ] ... }}
```
## 上传文件
- Request
| Method | URL |
| ------ | ------- |
| POST | /upload |
以老师讲的的方式传入
注意上传文件和上传封面的两个name属性,这两个input放在一个form中用一个submit提交:
```html
```
author、description等根据数据库给input的name属性赋值即可,其中author不可少
- Response
```
{
state:200,
message:null,
data:{
"文件url地址"
}
}
```
## 下载文件
- Request
| Method | URL |
| ------ | --------------- |
| GET | /download?bid=? |
例如:124.70.110.201:8080/download?bid=417
- Response
```
无,返回值为文件
```