Chuyaoyuan ab9749a111 feat: 积分/等级系统
- V10 migration: add score column, back-fill from activity counts, recompute level
- IScoreService + ScoreServiceImpl: addScore() atomically updates score and level in DB
- UsersRepository.addScore(): JPQL UPDATE with inline CASE level computation
- Level tiers: 0新手(<50) 1学徒(50) 2熟手(200) 3达人(500) 4专家(1000) 5大神(2000+)
- Score events:
  - Post discussion: +10 (UserPostController)
  - Post reply: +5 (UserPostController)
  - Discussion/post liked: +2 to author; unliked/undone: -2 (LikeCollectServiceImpl)
  - Score self-like guard: no points awarded when user votes on own content
- user-card API: expose level + score fields
- user.ftl: replace raw level number with color-coded Lv.N badge + 积分 stat
- discussions.ftl + index.ftl hover cards: show level badge and score

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-13 18:30:52 +08:00
2026-05-08 19:20:49 +08:00
2026-05-13 18:30:52 +08:00
2026-05-09 11:35:30 +08:00
2022-04-14 20:53:38 +08:00
2020-10-14 11:26:45 +08:00
2026-05-06 18:18:28 +08:00
2026-04-30 16:27:58 +08:00

中文   |   English

logo

Jiscuss

基于java的简单论坛系统,Jiscuss = Java + Discuss。


License MIT

Github 仓库   |   Gitee 仓库   |   在线体验

预览

sykhy4.md.png

简介

基于JAVA,使用SpringBoot + H2 Database + Semantic-UI + Freemarker 构建,官网:[www.jiscuss.com]

在线体验

部署

[一]、开发环境配置

// 需jdk 1.8以上,maven3以上。

[二]、下载代码

// Github - https://gitee.com/chuyaoyuan/Jiscuss.git
// Gitee - https://github.com/Chuyaoyuan/Jiscuss.git

[三]、运行启动(默认使用H2数据库,可以在配置文件切换MYSQL)

// 1、代码导入IDE


// 2、启动服务


// 4、访问地址
http://localhost

说明:以上为原始快速启动说明。当前升级后的 v2.0 分支已迁移到 Spring Boot 3,推荐使用 JDK 17 运行;旧版本中的 JDK 1.8 说明仅适用于早期分支。

当前升级版本说明

当前代码已完成 Spring Boot 3 兼容升级,主要技术栈如下:

  • Java 17
  • Spring Boot 3.3.5
  • Spring Security 6
  • Spring Data JPA / Hibernate 6
  • FreeMarker
  • H2 Database(开发环境默认)
  • MySQL 8(生产/外部数据库环境)
  • Flyway(数据库版本迁移)
  • SpringDoc OpenAPI(替代 Springfox Swagger
  • Ehcache 3 + JCache
  • Druid Spring Boot 3 Starter
  • MapStruct

环境要求

  • JDK17+
  • Maven3.8+
  • MySQL8.x(仅 mysql profile 需要)

检查本地环境:

java -version
javac -version
mvn -version

构建与启动

使用默认 H2 开发环境

项目默认激活 h2 profile

mvn spring-boot:run

访问:

http://localhost

如果本机 Linux 普通用户无法绑定 80 端口,可以临时指定其他端口:

mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8080"

然后访问:

http://localhost:8080

使用 MySQL 环境

  1. 创建数据库:
CREATE DATABASE jiscuss DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  1. 修改配置文件:
src/main/resources/application-mysql.yml

根据实际环境修改:

  • spring.datasource.url
  • spring.datasource.username
  • spring.datasource.password
  1. 启动 mysql profile
mvn spring-boot:run -Dspring-boot.run.profiles=mysql

数据库迁移说明

项目已使用 Flyway 接管数据库初始化和后续变更,迁移脚本位于:

src/main/resources/db/migration/

当前迁移文件:

  • V1__init_schema.sql:初始化表结构和基础数据
  • V2__security_updates.sql:安全相关字段/数据升级

注意:旧的 schema.sqldata.sql 已不再使用,避免与 Flyway 重复初始化。

安全与管理端点

  • 登录认证已迁移到 Spring Security 6 配置方式。
  • /admin/**/actuator/**/druid/** 需要管理员角色访问。
  • H2 Console 默认关闭;如需开发调试,可显式开启:
mvn spring-boot:run -Dspring-boot.run.arguments="--spring.h2.console.enabled=true"
  • OpenAPI 文档地址:
http://localhost/swagger-ui.html
http://localhost/v3/api-docs

网络不佳时的构建建议

如果依赖已经下载到本地 Maven 仓库,可以使用离线模式:

mvn -o -DskipTests compile

如果首次构建尚未下载 Spring Boot 3.3.5 等依赖,离线模式会失败,需要在网络可用时先执行一次:

mvn -DskipTests compile

国内网络环境可配置 Maven 镜像源后再构建。依赖下载完成后,后续即可使用 mvn -o 离线构建。

常用检查命令

编译检查:

mvn -DskipTests compile

打包:

mvn -DskipTests package

运行 jar

java -jar target/jiscuss-0.0.1-SNAPSHOT.jar

升级注意事项

  • Spring Boot 3 使用 jakarta.* 命名空间,旧的 javax.servletjavax.persistencejavax.validation 不再使用。
  • Hibernate 6 可自动识别数据库方言,配置中无需手动指定 database-platform
  • MySQL 连接已移除不推荐的 autoReconnect=true
  • JSON 响应优先使用 Spring MVC + Jackson 自动序列化,不再依赖 org.json
  • WebSocket starter 已移除;如后续确实需要实时通信,再按功能重新引入。

[四]、开源协议

MIT

S
Description
No description provided
Readme 5.2 MiB
Languages
Java 65.9%
HTML 34.1%