From 908479e58f13ecb4617498220a3d7a27d1370092 Mon Sep 17 00:00:00 2001 From: zpc Date: Tue, 24 Mar 2026 11:46:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .kiro/steering/product.md | 18 +++++++---- .kiro/steering/structure.md | 61 ++++++++++++++++++++++++++----------- .kiro/steering/tech.md | 6 ++-- README.md | 60 ++++++++++++++++++++++++++++++++++++ 4 files changed, 120 insertions(+), 25 deletions(-) create mode 100644 README.md diff --git a/.kiro/steering/product.md b/.kiro/steering/product.md index 7847ea1..ce5ae84 100644 --- a/.kiro/steering/product.md +++ b/.kiro/steering/product.md @@ -2,20 +2,26 @@ LiveForum (论坛社区) is a live-streaming forum platform for a talent agency (团播机构). It connects streamers with their audience through a community forum. -## Core Features -- WeChat Mini Program login and authentication +## Core Features (v1.0.1) +- WeChat Mini Program login and authentication (微信小程序登录) - Forum posts with comments, likes, and categories - Streamer profiles with flower (gift) ranking system -- Real-name verification (实名认证) -- CDK redemption system - Banner management with internal/external link navigation - Home popup configuration - User follow relationships - Push notifications (likes, replies, custom messages) - Sensitive word filtering - File uploads via Tencent COS -- Anti-addiction system -- Identity-based permission settings +- User feedback and reporting + +## v1.2.0 Features (已完成) +- CDK activation system (CDK 激活码) — users must activate CDK before performing interactions; admin can batch-create and manage CDKs; feature toggle in admin +- Phone number login and real-name verification (手机号登录与实名认证) — phone verification on login, real-name check before first interaction +- Post reply permission control — post authors can toggle whether replies are allowed per post +- Admin in-app post deletion — admin-level users can delete any post from within the Mini Program +- Post and reply interval settings — admin can configure time intervals per SK certification level +- Anti-addiction system (防沉迷) — admin configurable time-based restrictions on posting, replying, and gifting +- Identity-based permission settings (身份权限设置) — identity groups with granular permissions (post, reply, gift, like, delete others' posts); per-certification-level permissions; users can belong to multiple identity groups ## User-Facing Clients - WeChat Mini Program (primary client, built with uni-app + Vue 3) diff --git a/.kiro/steering/structure.md b/.kiro/steering/structure.md index dfa2981..c3a5f10 100644 --- a/.kiro/steering/structure.md +++ b/.kiro/steering/structure.md @@ -5,34 +5,59 @@ ├── server/ │ ├── webapi/LiveForum/ # Main forum API (.NET 8) │ │ ├── LiveForum.WebApi/ # Entry point, controllers, background services -│ │ │ ├── Controllers/ # API endpoints (Auth, Posts, Comments, etc.) -│ │ │ ├── BackgroundServices/ # Redis consumers, batch sync services +│ │ │ ├── Controllers/ # API endpoints (Auth, Posts, Comments, CDK, RealName, Config, etc.) +│ │ │ ├── BackgroundServices/ # Redis consumers, batch sync services (likes, views, flowers, messages) │ │ │ └── Program.cs # App bootstrap, DI, middleware pipeline │ │ ├── LiveForum.Service/ # Business logic (organized by domain) -│ │ ├── LiveForum.IService/ # Service interfaces (mirrors Service structure) -│ │ ├── LiveForum.Model/ # DTOs, entities, enums -│ │ │ ├── Dto/ # Data transfer objects -│ │ │ ├── Model/ # Database entities (T_ prefix) -│ │ │ └── Enum/ # Enumerations -│ │ ├── LiveForum.Code/ # Infrastructure & cross-cutting concerns -│ │ │ ├── JwtInfrastructure/ # JWT auth -│ │ │ ├── MiddlewareExtend/ # Custom middleware -│ │ │ ├── Redis/ # Redis service abstractions +│ │ │ ├── Auth/ # Login, WeChat auth +│ │ │ ├── Cdk/ # CDK activation logic +│ │ │ ├── Flowers/ # Flower gifting +│ │ │ ├── Home/ # Banners, popups +│ │ │ ├── Messages/ # Push notifications +│ │ │ ├── Others/ # WeChat Mini Program, file upload, etc. +│ │ │ ├── Permission/ # Identity group & certification permission checks +│ │ │ ├── Posts/ # Posts, comments, likes, categories +│ │ │ ├── RealName/ # Real-name verification +│ │ │ ├── ScheduledJobs/ # Hangfire jobs (flower reset, etc.) │ │ │ ├── SensitiveWord/ # Content filtering -│ │ │ └── Utility/ # Helpers +│ │ │ ├── Streamers/ # Streamer profiles +│ │ │ └── Users/ # User profiles, follows, certifications +│ │ ├── LiveForum.IService/ # Service interfaces (mirrors Service structure) +│ │ ├── LiveForum.Model/ # DTOs, entities, enums, events +│ │ │ ├── Dto/ # Data transfer objects (by domain) +│ │ │ ├── Model/ # Database entities (T_ prefix) +│ │ │ ├── Enum/ # Enumerations (PermissionType, LoginType, etc.) +│ │ │ └── Events/ # Domain events (flower, like, view, message) +│ │ ├── LiveForum.Code/ # Infrastructure & cross-cutting concerns +│ │ │ ├── AttributeExtend/ # Custom attributes (images, message, response cache) +│ │ │ ├── Base/ # BaseResponse, ResponseCode +│ │ │ ├── EventBus/ # Event bus infrastructure +│ │ │ ├── ExceptionExtend/ # Custom exceptions (LoginExpired, MessageBox, RedisNull) +│ │ │ ├── Extend/ # Request extensions +│ │ │ ├── JsonConverterExtend/ # JSON serialization customizations +│ │ │ ├── JwtInfrastructure/ # JWT auth (Redis-backed token management) +│ │ │ ├── MiddlewareExtend/ # Custom middleware (exception, execution time, sign, response cache) +│ │ │ ├── Redis/ # Redis service abstractions +│ │ │ ├── SensitiveWord/ # Content filtering engine +│ │ │ ├── SystemCache/ # System-level caching (AppConfig, field cache) +│ │ │ └── Utility/ # Helpers (MD5, phone validation, date, HTTP, etc.) │ │ ├── LiveForum.Repository/ # Data access (FreeSql) │ │ ├── LiveForum.Tests/ # xUnit + FsCheck tests │ │ └── DatabaseScripts/ # SQL migration scripts │ │ │ ├── admin/ZrAdminNetCore/ # Admin panel backend │ │ ├── ZR.Admin.WebApi/ # Admin API entry point -│ │ ├── ZR.Service/ # Admin business logic -│ │ ├── ZR.LiveForum/ # Forum-specific admin services -│ │ ├── ZR.LiveForum.Model/ # Forum admin models +│ │ │ └── Controllers/Liveforum/ # Forum admin CRUD endpoints (CDKs, permissions, anti-addiction, etc.) +│ │ ├── ZR.Service/Liveforum/ # Admin business logic (CRUD services for all forum entities) +│ │ ├── ZR.LiveForum/ # Forum-specific admin controllers +│ │ ├── ZR.LiveForum.Model/ # Forum admin models (mirrors WebAPI entities) │ │ ├── ZR.Model/ # Core admin models -│ │ ├── ZR.Vue/ # Admin panel frontend (Vue 3 + Vite + Element Plus, 后台管理前端) +│ │ ├── ZR.Vue/ # Admin panel frontend (Vue 3 + Vite + Element Plus) │ │ └── Infrastructure/ # Shared admin infrastructure │ │ +│ ├── admin/browser-extension/ # Browser extension for cookie management +│ │ └── live-forum-cookie/ # Chrome extension for forum cookie extraction +│ │ │ ├── crawler/ # Python data crawlers │ │ ├── commerce/ # Commerce streamer data │ │ └── entertainment/ # Entertainment streamer data @@ -58,9 +83,11 @@ ``` ## Key Conventions -- Database entity classes use `T_` prefix (e.g., `T_Users`, `T_Posts`) +- Database entity classes use `T_` prefix (e.g., `T_Users`, `T_Posts`, `T_IdentityGroups`) - Services are organized by domain folder in both Service and IService projects - Service interfaces mirror the Service folder structure - Autofac auto-registers services from `LiveForum.Service` assembly (except singletons registered in Program.cs) - SQL migration scripts go in `DatabaseScripts/` - Requirements documents are versioned under `docs/{version}/` +- Domain events in `LiveForum.Model/Events/` for async operations (likes, views, flowers, messages) +- Permission checks centralized in `LiveForum.Service/Permission/PermissionService.cs` diff --git a/.kiro/steering/tech.md b/.kiro/steering/tech.md index 8edcf80..deda9e2 100644 --- a/.kiro/steering/tech.md +++ b/.kiro/steering/tech.md @@ -8,11 +8,13 @@ - Background Jobs: Hangfire (SQL Server storage) - Config: AgileConfig (remote config center with hot reload) - Logging: Serilog (console + file) -- Auth: JWT tokens (validated against DB) +- Auth: JWT tokens (Redis-backed token management, validated against DB) - WeChat SDK: SKIT.FlurlHttpClient.Wechat.Api - File Storage: Tencent COS - JSON: Newtonsoft.Json (camelCase, custom converters) - Testing: xUnit + FsCheck (property-based testing) + Moq +- System Cache: Custom field-level and system-level caching layer (SystemCache/) +- Domain Events: Event-driven async processing for likes, views, flowers, messages ## Admin Panel — `server/admin/ZrAdminNetCore/` - .NET 8 (ZrAdminNetCore framework) @@ -37,7 +39,7 @@ ## Databases - SQL Server (primary, for both WebAPI and Admin) -- Redis (caching, message queues, batch sync buffers) +- Redis (caching, message queues, batch sync buffers, JWT token store) ## Common Commands diff --git a/README.md b/README.md new file mode 100644 index 0000000..7d24b70 --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# LiveForum 论坛社区 + +[![Build Status](http://192.168.195.25:13080/api/badges/outsource/live-forum/status.svg)](http://192.168.195.25:13080/outsource/live-forum) + +直播机构论坛社区平台,连接主播与粉丝。 + +## 项目结构 + +``` +├── server/ +│ ├── webapi/LiveForum/ # 小程序 API(.NET 8 + FreeSql + Redis) +│ ├── admin/ZrAdminNetCore/ # 后台管理 +│ │ ├── ZR.Admin.WebApi/ # 后台 API(.NET 8 + SqlSugar) +│ │ └── ZR.Vue/ # 后台前端(Vue 3 + Element Plus) +│ ├── crawler/ # 数据爬虫(Python + Playwright) +│ └── k6/ # 压力测试脚本 +├── 前端/live-forum/ # 微信小程序(uni-app + Vue 3) +└── docs/ # 需求文档 +``` + +## 技术栈 + +| 模块 | 技术 | +|------|------| +| 小程序 API | .NET 8、FreeSql、Redis、Hangfire、AgileConfig、Serilog | +| 后台管理 API | .NET 8、SqlSugar、Mapster、NLog | +| 后台前端 | Vue 3、Vite、Element Plus、Pinia | +| 小程序前端 | uni-app、Vue 3、uview-plus | +| 数据库 | SQL Server、Redis | +| 文件存储 | 腾讯云 COS | +| 配置中心 | AgileConfig | + +## 本地开发 + +### 小程序 API +```bash +cd server/webapi/LiveForum +dotnet restore LiveForum.sln +dotnet run --project LiveForum.WebApi +``` + +### 后台管理 API +```bash +cd server/admin/ZrAdminNetCore +dotnet restore ZRAdmin.sln +dotnet run --project ZR.Admin.WebApi +``` + +### 后台前端 +```bash +cd server/admin/ZrAdminNetCore/ZR.Vue +npm install +npm run dev +``` + +## CI/CD + +基于 Drone CI + Docker + Harbor,推送 `main` 分支自动触发构建和部署。 + +详见 [CI-CD部署文档.md](CI-CD部署文档.md)