feat(admin): Implement operational monitoring MVP and login optimization
Summary: - Add SimpleLog table for activity tracking (admin_schema) - Implement ActivityService with fire-and-forget pattern - Add stats API endpoints (overview/live-feed/user-overview/cleanup) - Complete activity logging for 7 modules (SYSTEM/AIA/PKB/ASL/DC/RVW/IIT) - Update Admin Dashboard with DAU/DAT metrics and live feed - Fix user module permission display logic - Fix login redirect to /ai-qa instead of homepage - Replace top navigation LOGO with brand image - Fix PKB workspace layout CSS conflict (rename to .pa-chat-container) New files: - backend/src/common/services/activity.service.ts - backend/src/modules/admin/controllers/statsController.ts - backend/src/modules/admin/routes/statsRoutes.ts - frontend-v2/src/modules/admin/api/statsApi.ts - docs/03-.../04-operational-monitoring-mvp-plan.md - docs/03-.../04-operational-monitoring-mvp-implementation.md Tested: All features verified locally
This commit is contained in:
@@ -970,6 +970,34 @@ model admin_operation_logs {
|
||||
@@schema("admin_schema")
|
||||
}
|
||||
|
||||
/// 运营日志表 (MVP V3.1)
|
||||
/// 用于记录用户行为,支持 DAU/DAT 统计和用户360画像
|
||||
model simple_logs {
|
||||
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
||||
created_at DateTime @default(now())
|
||||
|
||||
// 租户和用户信息
|
||||
tenant_id String @db.VarChar(50)
|
||||
tenant_name String? @db.VarChar(100) // 冗余字段,避免JOIN
|
||||
user_id String @db.Uuid
|
||||
user_name String? @db.VarChar(50)
|
||||
|
||||
// 行为记录
|
||||
module String @db.VarChar(20) // AIA, PKB, ASL, DC, RVW, IIT, SSA, ST, SYSTEM
|
||||
feature String @db.VarChar(50) // 细分功能
|
||||
action String @db.VarChar(20) // LOGIN, USE, EXPORT, CREATE, DELETE, ERROR
|
||||
|
||||
// 详情信息
|
||||
info String? @db.Text // JSON或文本详情
|
||||
|
||||
@@index([created_at], map: "idx_simple_logs_created_at")
|
||||
@@index([tenant_id], map: "idx_simple_logs_tenant_id")
|
||||
@@index([user_id], map: "idx_simple_logs_user_id")
|
||||
@@index([module, feature], map: "idx_simple_logs_module_feature")
|
||||
@@index([action], map: "idx_simple_logs_action")
|
||||
@@schema("admin_schema")
|
||||
}
|
||||
|
||||
model departments {
|
||||
id String @id
|
||||
tenant_id String
|
||||
|
||||
Reference in New Issue
Block a user