# 知识交流分享平台 **Repository Path**: paochai/knowledge-project ## Basic Information - **Project Name**: 知识交流分享平台 - **Description**: springboot知识交流分享平台 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 6 - **Forks**: 0 - **Created**: 2022-04-13 - **Last Updated**: 2024-02-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: SpringBoot, Java ## README # 知识交流分享平台 ## 项目简介 一个知识交流分享平台,不仅实现了基本的注册、登录、发帖、评论、回复、私信等功能,同时使用前缀树实现敏感词过滤;使用 Redis 实现点赞与关注;实现网站 UV 和 DAU 统计;并将用户头像等信息存于七牛云服务器。 ## 测试账号 | 用户类型 | 用户名 | 密码 | | -------- | ------ | ------ | | 普通用户 | user | 123456 | | 版主 | banzhu | 123456 | | 管理员 | admin | 123456 | ## 功能列表 ### 已经实现了的功能 - 邮件发送 - 注册 - 验证码 - 登录 - 修改头像 - 修改密码 - 敏感词过滤 - 发布帖子 - 我的帖子 - 帖子详情 - 评论 - 私信 - 统一异常处理 - 统一日志处理 - 点赞 - 关注 - 系统通知 - 搜索 - 权限控制 - 置顶、加精、删除 - 网站统计 - 定时执行任务计算热门帖子 - 文件上传至七牛云 ### TO DO List - 积分模块 - 收藏模块 - 浏览量 ## 功能简介 - 使用 Redis 的 set 实现点赞,zset 实现关注,并使用 Redis 存储登录ticket和验证码,解决分布式 Session 问题,使用 Redis 的高级数据类型 HyperLogLog 统计 UV (Unique Visitor),使用 Bitmap 统计 DAU (Daily Active User)。 - 使用Redis Cell模块对用户发帖进行限流,防止恶意灌水。 - 使用 Kafka 处理发送评论、点赞、关注等系统通知、将新发布的帖子异步传输至Elasticsearch服务器,并使用事件进行封装,构建了强大的异步消息系统。 - 使用Elasticsearch做全局搜索,增加关键词高亮显示等功能。 - 热帖排行模块,使用本地缓存 Caffeine作为一级缓存和分布式缓存 Redis作为二级缓存构建多级缓存,避免了缓存雪崩,同时使用使用压测工具测试优化前后性能,将 QPS 提升了4.4倍 (7.6/sec -> 33.5/sec),大大提升了网站访问速度。 - 使用 Quartz 定时更新热帖排行。 - 使用 Spring Security 做权限控制,替代拦截器的拦截控制,并使用自己的认证方案替代 Security 认证流程,使权限认证和控制更加方便灵活。 ## 技术栈 | 技术 | 链接 | 版本 | | --------------- | ------------------------------------------------------------ | -------------- | | Spring Boot | https://spring.io/projects/spring-boot | 2.4.3 | | Spring | https://spring.io/projects/spring-framework | 5.3.4 | | Spring MVC | https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#spring-web | 5.3.4 | | MyBatis | http://www.mybatis.org/mybatis-3 | 3.5.1 | | Redis | https://redis.io/ | 5.0.3 | | Kafka | http://kafka.apache.org/ | 2.7.0 | | Elasticsearch | https://www.elastic.co/cn/elasticsearch/ | 7.9.3 | | Spring Security | https://spring.io/projects/spring-security | 5.4.5 | | Spring Quartz | https://www.baeldung.com/spring-quartz-schedule | 2.3.2 | | wkhtmltopdf | [https://wkhtmltopdf.org](https://wkhtmltopdf.org/) | 0.12.6 | | kaptcha | https://github.com/penggle/kaptcha | 2.3.2 | | Thymeleaf | https://www.thymeleaf.org/ | 3.0.12.RELEASE | | MySQL | https://www.mysql.com/ | 5.7.17 | | JDK | https://www.oracle.com/java/technologies/javase-downloads.html | 1.8 | ## 系统架构 [![image-20210331103427522](https://camo.githubusercontent.com/6d55445dfb526d88dab3fb9bed4f97c402a2dd41c4cc379886bf8404878eabf5/68747470733a2f2f67697465652e636f6d2f7a68656e6767756f6875616e672f696d672f7261772f6d61737465722f696d672f696d6167652d32303231303333313130333432373532322e706e67)](https://camo.githubusercontent.com/6d55445dfb526d88dab3fb9bed4f97c402a2dd41c4cc379886bf8404878eabf5/68747470733a2f2f67697465652e636f6d2f7a68656e6767756f6875616e672f696d672f7261772f6d61737465722f696d672f696d6167652d32303231303333313130333432373532322e706e67) [![网站架构图](https://camo.githubusercontent.com/f4ccf73a318680b92eb1544fdb797058851c1319c542de4fe15307d52918acff/68747470733a2f2f67697465652e636f6d2f7a68656e6767756f6875616e672f696d672f7261772f6d61737465722f696d672f2545372542442539312545372541422539392545362539452542362545362539452538342545352539422542452e706e67)](https://camo.githubusercontent.com/f4ccf73a318680b92eb1544fdb797058851c1319c542de4fe15307d52918acff/68747470733a2f2f67697465652e636f6d2f7a68656e6767756f6875616e672f696d672f7261772f6d61737465722f696d672f2545372542442539312545372541422539392545362539452542362545362539452538342545352539422542452e706e67) ## 数据库初始化 ``` create database community; use community; source /path/to/sql/init_schema.sql; source /path/to/sql/init_data.sql; source /path/to/sql/tables_mysql_innodb.sql; ``` ## 运行 1. 安装JDK,Maven 2. 克隆代码到本地 ```bash git clone https://gitee.com/paochai/knowledge-project.git ``` 3. 配置mysql、七牛云、kafka、ElasticSearch 4. 启动zookeeper 5. 启动Kafka 6. 启动Elasticsearch 7. 运行打包命令 ``` mvn package ``` 8. 运行项目 ``` java -jar xxx.jar ``` 9. 访问项目 ``` http://localhost:8080 ```