# portal-platform-manager **Repository Path**: MOLATERS/portal-platform-manager ## Basic Information - **Project Name**: portal-platform-manager - **Description**: 门户平台管理器 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-05-15 - **Last Updated**: 2024-06-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: 本科项目 ## README # 后端提供接口使用说明 ## User相关 ### 增加用户 使用接口:localhost:8080/add/user 使用方法:Post方法 输入格式: ```json { "user_name":"", "pass_word":"" } ``` 输入样例: ```json { "user_name":"jason", "pass_word":"123456" } ``` 返回样例: ```json { "data": { "userName": "jason", "passWord": "123456", "img": null }, "success": true, "errormsg": null } ``` 异常检测: 当输入用户名与当前数据库中已有用户名重复时,输出错误提示信息: ```json { "data": null, "success": false, "errormsg": "该用户名已被注册!请重新输入!" } ``` ### 登录 使用接口:localhost:8080/login/{user_name}/{pass_word} 使用样例:localhost:8080/login/jason/123456 使用方法:Get 样例1:(用户名,密码均存在于数据库) 输入: localhost:8080/login/jason/123456 输出: ```json { "data": { "id": 2, "userName": "jason", "passWord": "123456" }, "success": true, "errormsg": null } ``` 样例2:(用户名不存在) 输入: localhost:8080/login/jason12/123456 输出: ```json { "data": null, "success": false, "errormsg": "错误!并不存在该用户" } ``` 样例3:(密码错误) 输入: localhost:8080/login/jason/123 输出: ```json { "data": null, "success": false, "errormsg": "密码错误!" } ``` ### 增加头像 使用端口:localhost:8080/add/image 使用方法:POST 样例输入: ![img_1.png](img_1.png) ### 获取头像 使用端口:localhost:8080/get/image/{user_name} 使用方法:GET 样例输入:localhost:8080/get/image/jason ## Website相关 ### 初始化 使用端口:localhost:8080/gen/{user_name} 使用方法:Get 返回值:当前所存储的所有数据,以data.json中的数据类型进行返回 * 注意!!!以后的所有操作建立在已经使用过一次该端口的基础上,要切换用户时务必使用该接口!!! ### 对组(group)进行操作 #### 增加 使用端口:localhost:8080/add/group ‍使用方法:Post ‍输入格式: ```json { "new_group_name":"" } ``` 样例: ‍输入: ```json { "new_group_name":"a" } ``` 输出: ```json { "data": { "id": 7, "groupName": "a", "user_name": "jason" }, "success": true, "errormsg": null } ``` #### 删除 使用端口:localhost:8080/delete/group/{group_name} 使用方式:Delete 输入样例:localhost:8080/delete/group/日常 输出样例 ```json { "data": null, "success": true, "errormsg": null } ``` #### 修改 使用端口:localhost:8080/modify/group ‍使用方法:Post ‍输入格式: ```json { "old_group_name":"", "new_group_name":"" } ``` 样例: 输入: ```json { "old_group_name":"乐", "new_group_name":"娱乐" } ``` 输出: ```json { "data": { "id": 0, "group_name": "娱乐" }, "success": true, "errormsg": null } ``` ### 对类(Class)进行操作 #### 增加 使用端口:localhost:8080/add/class ‍使用方法:Post 输入格式: ```json { "groupname":"", "new_classname":"" } ``` 输入样例: ```json { "groupname":"a", "new_class_name":"b" } ``` 返回样例: ```json { "data": { "id": 49, "className": "b", "groupName": "a", "user_name": "jason" }, "success": true, "errormsg": null } ``` #### 删除 使用端口:localhost:8080/delete/class/{group_name}/{class_name} 使用方式:Delete 输入样例:localhost:8080/delete/class/开发/工具 输出样例: ```json' { "data": null, "success": true, "errormsg": null } ``` #### 修改 使用端口:localhost:8080/modify/class 使用方法:Post ‍输入格式: ```json { "group_name":"", "old_class_name":"", "new_class_name":"" } ``` ‍样例: 输入: ```json { "group_name":"娱乐", "old_class_name":"游戏", "new_class_name":"玩" } ``` 输出: ```json { "data": { "id": 0, "className": "玩", "groupName": "娱乐", "user_name": "jason" }, "success": true, "errormsg": null } ``` ### 对网站进行操作 #### 在分组之间移动网站 使用端口:localhost:8080/move ‍使用方法:Post ‍输入格式: ```json { "webname":"", "old_groupname":"", "old_classname":"", "new_groupname":"", "new_classname":"" } ``` 输入样例: ```json { "webname":"微博", "old_groupname":"日常", "old_classname":"购物", "new_groupname":"日常", "new_classname":"社交" } ``` 输出样例: ```json { "data": { "name": "微博", "url": "https://weibo.com/" }, "success": true, "errormsg": null } ``` #### 增加网站 使用端口:localhost:8080/add/website 使用方法:Post 输入格式: ```json { "item_name":"", "group_name":"", "class_name":"", "url":"" } ``` 输入样例: ```json { "item_name":"PRTS", "group_name":"娱乐", "class_name":"游戏", "url":"https://prts.wiki/w/%E9%A6%96%E9%A1%B5" } ``` 输出样例: ```json { "data": { "id": 289, "url": "https://prts.wiki/w/%E9%A6%96%E9%A1%B5", "content": null, "initContent": null, "vector": null, "user_name": "jason", "itemname": "PRTS", "classname": "游戏", "groupname": "娱乐" }, "success": true, "errormsg": null } ``` #### 删除网站 使用端口:localhost:8080/delete/website ‍使用方法:Post ‍输入样例: ```json { "group_name":"", "class_name":"", "item_name": "" } ``` 输出样例: ```json { "data": null, "success": true, "errormsg": null } ``` #### 根据网站URL生成组推荐 使用端口:localhost:8080/gen/group 使用方法:Post 输入格式: ```json { "website_url":"" } ``` 输入样例: ```json { "website_url":"https://prts.wiki/w/%E9%A6%96%E9%A1%B5" } ``` 输出样例: ```json { "data": { "id": 1, "group_name": "日常" }, "success": true, "errormsg": null } ``` #### 自动获取门户网站 使用端口:localhost:8080/gen/website/{website_name} 使用方法:Get ## 收藏相关 ### 添加收藏 使用端口:localhost:8080/add/collections ‍使用方法:Post ‍输入格式: ```json { "user_name":"", "website":"" } ``` 输入样例: ```json { "user_name":"jason", "website":"微博" } ``` 输出样例: ```json { "data": { "id": 1, "userName": "jason", "website": "微博", "url": "https://weibo.com/" }, "success": true, "errormsg": null } ``` ```json { "data": null, "success": false, "errormsg": "错误!并不存在该用户!" } ``` ```json { "data": null, "success": false, "errormsg": "错误!并不存在该网站!" } ``` ### 获得收藏 使用端口:localhost:8080/gen/collections/{user_name} ‍使用方法:Get ‍输入样例:localhost:8080/gen/collections/jason 输出样例: ```json { "data": [ { "id": 1, "userName": "jason", "website": "微博", "url": "https://weibo.com/" } ], "success": true, "errormsg": null } ``` ### 删除收藏 使用端口:localhost:8080/delete/collections/{user_name}/{website_name} ‍使用方法:Delete ‍输入样例:localhost:8080/delete/collections/jason/微博 输出样例: ```json { "data": null, "success": true, "errormsg": null } ``` ## 喜爱度相关 ### 用户点击网站 使用接口:localhost:8080/love/click 使用方式:Post 输入格式: ```json { "user_name":"", "website":"" } ``` 样例: 输入 ```json { "user_name":"jason", "website":"知乎" } ``` 输出: ```json { "data": null, "success": true, "errormsg": null } ``` ### 生成用户的喜爱度列表 使用接口:localhost:8080/gen/love/{user_name} 使用方式:Get 输入格式:localhost:8080/gen/love/jason 输出样例: ```json { "data": [ { "id": 7, "userName": "jason", "website": "贴吧", "url": "https://tieba.baidu.com/", "seq": 5 }, { "id": 8, "userName": "jason", "website": "抖音", "url": "https://www.douyin.com/", "seq": 4 }, { "id": 9, "userName": "jason", "website": "steam", "url": "https://store.steampowered.com/", "seq": 3 }, { "id": 10, "userName": "jason", "website": "PRTS", "url": "https://prts.wiki/w/%E9%A6%96%E9%A1%B5", "seq": 2 }, { "id": 11, "userName": "jason", "website": "知乎", "url": "https://www.zhihu.com/", "seq": 1 } ], "success": true, "errormsg": null } ``` ## 建表命令 ``` create table group_table( id int primary key auto_increment, group_name varchar(50) unique ); ``` ``` create table Class( id int primary key auto_increment, class_name varchar(50), group_name varchar(50), unique(group_name,class_name) ); ``` ``` create table website( id int primary key auto_increment, item_name varchar(50), group_name varchar(50) , class_name varchar(50) , url text, content mediumtext null, init_content longtext null, vector longblob null, unique(group_name,class_name,item_name) ); ``` ``` create table user_group_table( id int primary key auto_increment, user_name varchar(50), group_name varchar(50), unique(user_name, group_name) ); ``` ``` create table user_class( id int primary key auto_increment, user_name varchar(50), class_name varchar(50), group_name varchar(50), unique(user_name, group_name, class_name) ); ``` ``` create table user_website( id int primary key auto_increment, user_name varchar(50), item_name varchar(50), group_name varchar(50) , class_name varchar(50) , url text, content mediumtext null, init_content longtext null, vector longblob null, unique(user_name,group_name,class_name,item_name) ); ``` ``` create table user( user_name varchar(50) primary key, pass_word text, img binary ); ``` ``` create table collections( id int primary key auto_increment, user_name varchar(50), website varchar(50), url text, unique(user_name,website) ); ``` ``` create table love( id int primary key auto_increment, user_name varchar(50), website varchar(50), url text, seq int, unique(user_name,website) ); ```