# education **Repository Path**: shanchuanc/education ## Basic Information - **Project Name**: education - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2016-10-14 - **Last Updated**: 2021-11-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #url : 210.30.100.4 #port : 8765 #通用响应格式 ```json Response:{ error: STRING, status: INTERGER, msg: STRING || OBJECT } ``` * status code: * 200-OK * 4xx-Invalid Request * 400-Bad Request 请求参数或请求格式错误 * 401-Unauthorized 请求需要的用户状态不正确 * 403-Forbidden 服务器禁止用户得到响应 * 5xx-Server Error * 500-Internal Server Error #用户模块 ##登陆和注册 ###注册接口: **/user/add** Method:POST ```json RequestData:{ username: STRING, password: STRING, email: STRING, mobile: STRING, //mobile和email应该至少有其一 type: KEY || undefined //请联系后台管理员获得管理注册接口 } ``` 响应格式: ```json Response:{ error: STRING, status: INTERGER, msg: {LoginToken : STRING} } ``` ###登录接口: **/user/login** Method:POST ```json RequestData:{ username: STRING, email: STRING, mobile: STRING, //三者必须至少有其一 password: STRING } ``` 响应格式: cookies:LoginToken=...................... ```json Response:{ error: STRING, status: INTERGER, msg: {LoginToken : STRING} } ``` ##请求发送验证码 ###向email发送验证码 **/user/validate/email** 有+120s的发送冷却时间 ```json RequestData:{ LoginToken: STRING, username: STRING, email: STRING, mobile: STRING, //四者必须至少有其一 } ``` ###向手机发送验证码 **/user/validate/mobile** 有+120s的发送冷却时间 ```json RequestData:{ LoginToken: STRING, username: STRING, email: STRING, mobile: STRING //四者必须至少有其一 } ``` ##笔记接口 ###添加笔记: **/user/notes/add** Method:POST ``` RequestData:{ title: STRING, //课程名称 LoginToken: STRING, //可选,若Cookie中已有LoginToken,则不需要附加此字段 username: STRING, content: STRING, //笔记内容 chapter: STRING //添加到的章节 } ``` 响应格式: ```json Response:{ Response:{ error: STRING, status: INTERGER, msg: STRING } } ``` ###获取笔记: **/user/notes/list** Method:GET ``` Query:{ title: STRING, LoginToken: loginToken, //可选,若Cookie中已有LoginToken,则不需要附加此字段 username: STRING, chapter: STRING } ``` 响应格式: ```json Response:{ error: STRING, status: INTERGER, msg: {result: ARRAY} } ``` ###删除笔记: **/user/notes/delete** Method:POST ``` Query:{ id: INTEGER, LoginToken: loginToken, //可选,若Cookie中已有LoginToken,则不需要附加此字段 username: STRING, } ``` 响应格式: ```json Response:{ error: STRING, status: INTERGER, msg: STRING } ``` #课程模块 ##获取课程列表和具体课程和观看具体课程的视频和课程上传 ###获取课程列表接口: **/course/list** **Method:GET** ```json RequestData:{ level: INT, //allowNull(true),视频难度,level是按简单1,中级2,困难3 limit: INT, //allowNull(true) limit 是返回的课程数量,默认是10 page: INT //allowNull(true) 页码,从第一页开始,默认是第一页 search: STRING //allowNull(true) 模糊查询 } ``` ```json Response:{ courses: courses //课程的对象数组 } ``` ###获取具体课程接口: **/course/specific/:id** **Method:GET** id是课程的id号 ```json Response:{ course: course, //该课程信息 isLike: BOOL, //用户是否喜欢,当用户没有登录时,返回null isFollow: BOOL //用户是否关注,当用户没有登录时,返回null } ``` ###获取具体课程视频接口: **/course/video/:id** **Method:GET** id是课程的id号 ###上传课程接口: **/course/upload** **Method:post** id是课程的id号 ```json Response:{ course, //(name = course) title, difficulty, // allowNull(true) 1是简单,2是普通,3是困难 description, teacher, cover, //allowNull(true)//封面(图片) } ``` #论坛模块(需要登录) ##搜索帖子 添加帖子 回复帖子 ###获取帖子接口(可搜索): **/forum/index** **Method:GET** ```json RequestData:{ page: INT, //allowNull(true),默认第一页 count: INT, //allowNull(true) 默认返回10条信息 order: INT //allowNull(true) 0是按创建日期,1是按回复数量,默认是按创建日期 search: STRING //allowNull(true) 搜索title } ``` ```json Response:{ list: list //帖子的对象数组 } ``` ###添加帖子接口(可搜索): **/forum/addTopic** **Method:GET** ```json RequestData:{ title: INT, //allowNull(false) text: INT, //allowNull(false) } ``` ```json Response:{ code: 0 } ``` ###回复帖子接口(可搜索): **/forum/addComment** **Method:GET** ```json RequestData:{ uId: INT, //allowNull(false) uId是回复的帖子的id text: INT, //allowNull(false) type: INT //allowNull(false) type是类型,1是回复帖头,2是回复帖子 } ``` ```json Response:{ code: 0 } ``` ###获取帖子所有回复接口(可搜索): **/forum/getComment** **Method:GET** ```json RequestData:{ id : INT //帖子的id } ``` ```json Response:{ list: //json数组对象 } ``` #评论课程模块(需要登录) ##添加评论,删除评论 ###添加评论接口 **/course/addComment/:id** **id是课程的id 或者 目的评论的id (具体看type都类型,对目的评论都还没写) **Method:POST** ```json RequestData:{ type: INT //1是添加一条评论,2是对评论的评论 text: STRING } ``` ```json Response:{ id: INT, //该评论的id text: STRING, type: INT, star, //点赞人数 UserId, CourseId } ``` ###删除评论接口 **/course/delComment/:id** **id是 comment 的id **Method:POST** ```json Response:{ count: INT //1代表删除,0代表没有或者没有权限删除 } ```