lili 3f35acb4d3 feat(community): U3 R-SOC 评论/关注/排行ZSET/弹幕WS
社区社交后端四子能力(game-module-community),克隆通知底座/feed互动幂等范式:

- 评论 Comments:CRUD + 举报转 compliance。删除按 userId 归属强校验(防越权删他人评论),
  举报落本端举报态幂等 + 事务提交后 afterCommit 接缝(compliance 无受理 -api,留桩 OPEN ITEM)。
- 关注 Follow:active 软开关幂等切换(不删行,范本=feed FeedInteractLog),不能关注自己,
  并发双插由 DB 唯一键 DuplicateKeyException CAS 收敛;粉丝数/关注数 countActive。
- 排行 Ranking:Redis ZSET + ZSET↔DB 一致性窗口。DB=真相、ZSET=缓存索引:
  写穿透双写(DB 原子累加 + ZSET incrementScore)、ZSET 缺失/启动从 DB 回填重建、最终一致;
  维度白名单 RankDimensionEnum(game_hot/creator_hot)。
- 弹幕 Danmaku:WebSocket 单机最小实(LocalWebSocketMessageSender),自维护房间 gameId→sessionId
  注册表做房间维度广播(框架仅按用户维度推送),断连懒清理;多实例需切 sender-type=redis(MQ future-state 未部署)。

契约/库表:
- Flyway V23.0.0(U3 独占 V23.x):game_community_comment/follow/rank/danmaku 四表 +
  幂等唯一键(follow uk(user_id,target_user_id,deleted,tenant_id)、rank uk(dimension,target_id,...)),
  同步 huijing-server/db/migration + contracts/db-schemas。
- community.yaml additive 加 8 个 app 端点 + 5 个 schema(既有冻结)。
- 错误码段 1-107-004 评论 / 005 关注 / 006 排行 / 007 弹幕。

验证:mvn -pl game-module-community/game-module-community-server -am test -o 全绿
(57 tests:新增 U3 35 + 既有 22;CommentService 9 / FollowService 8 / RankService 8 / Danmaku 10)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 11:01:24 -07:00

89 lines
3.6 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.wanxiang</groupId>
<artifactId>game-module-community</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>game-module-community-server</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>
community 模块业务实现:controller(app/admin) / service(message·notify·level) / dal(DO·Mapper) / convert / CommunityNotifyApiImpl(@Primary)。
被 huijing-server 聚合启动(随单体一起加载,无需独立 bootstrap)。
卫生项(克隆黄金模块 project 后已剔除):通知底座自包含、不调任何跨模块 -api,
故删除 project 发布编排专用的 compliance-api/runtime-api/feed-api/huijing-module-system-api 四个跨模块依赖(与「最小变更」一致)。
</description>
<dependencies>
<!-- Spring Cloud 基础环境 -->
<dependency>
<groupId>com.wanxiang</groupId>
<artifactId>huijing-spring-boot-starter-env</artifactId>
</dependency>
<!-- 本模块对外契约层 -->
<dependency>
<groupId>com.wanxiang</groupId>
<artifactId>game-module-community-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件:数据权限(框架基建,DO 继承 TenantBaseDO 配套)+ 多租户 -->
<dependency>
<groupId>com.wanxiang</groupId>
<artifactId>huijing-spring-boot-starter-biz-data-permission</artifactId>
</dependency>
<dependency>
<groupId>com.wanxiang</groupId>
<artifactId>huijing-spring-boot-starter-biz-tenant</artifactId>
</dependency>
<!-- Web + 安全:@RestController / @PreAuthorize / 当前登录用户 / 系统身份注入(LoginUser) -->
<dependency>
<groupId>com.wanxiang</groupId>
<artifactId>huijing-spring-boot-starter-security</artifactId>
</dependency>
<!-- DB:MyBatis Plus(BaseMapperX / LambdaQueryWrapperX / BaseDO) -->
<dependency>
<groupId>com.wanxiang</groupId>
<artifactId>huijing-spring-boot-starter-mybatis</artifactId>
</dependency>
<!-- 缓存 -->
<dependency>
<groupId>com.wanxiang</groupId>
<artifactId>huijing-spring-boot-starter-redis</artifactId>
</dependency>
<!-- WebSocket:弹幕实时房间广播(U3 R-SOC,LocalWebSocketMessageSender 单机,多实例切 sender-type=redis) -->
<dependency>
<groupId>com.wanxiang</groupId>
<artifactId>huijing-spring-boot-starter-websocket</artifactId>
</dependency>
<!-- RPC 远程调用(CommunityNotifyApi 同进程 @Primary 解析需 Feign 基建在类路径) -->
<dependency>
<groupId>com.wanxiang</groupId>
<artifactId>huijing-spring-boot-starter-rpc</artifactId>
</dependency>
<!-- 测试 -->
<dependency>
<groupId>com.wanxiang</groupId>
<artifactId>huijing-spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
</build>
</project>