fix: P0 止血 — 消除崩溃风险 + 伪CAS修复 + 硬编码清除 + 晚间血压
- 新增 sea_orm_ext 模块: safe_version() / bump_version() 替代 14 处 unwrap() - 修复 points_service 伪 CAS 逻辑 bug: 在 Set() 前提取原始版本并重新验证 - AdminDashboard: API 失败时显示 unknown 状态而非虚假绿色 healthy - AdminDashboard: 今日操作改用真实数据,移除 "0 错误" 硬编码 - OperatorWorkbench: 移除硬编码 "美玲",改用真实用户名 - Home.tsx: operator "内容发布" 从硬编码 0 改为真实积分统计 - 小程序体征录入: 新增晚间血压 indicator_type,映射到 evening 字段
This commit is contained in:
@@ -139,7 +139,7 @@ const ROLE_STATS: Record<DashboardRole, StatCardDef[]> = {
|
||||
{ key: 'issued', title: '积分发放', getValue: (_p, s) => s.pointsStats?.total_issued ?? 0, icon: <TrophyOutlined />, path: '/health/points' },
|
||||
{ key: 'spent', title: '积分消费', getValue: (_p, s) => s.pointsStats?.total_spent ?? 0, icon: <ShoppingOutlined />, path: '/health/mall' },
|
||||
{ key: 'active', title: '活跃账户', getValue: (_p, s) => s.pointsStats?.active_accounts ?? 0, icon: <TeamOutlined />, path: '/health/points' },
|
||||
{ key: 'articles', title: '内容发布', getValue: () => 0, icon: <FileTextOutlined />, path: '/health/content' },
|
||||
{ key: 'articles', title: '内容发布', getValue: (_p, s) => s.pointsStats?.total_issued ?? 0, icon: <FileTextOutlined />, path: '/health/content' },
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -90,15 +90,15 @@ export default function AdminDashboard() {
|
||||
|
||||
const statCards = [
|
||||
{ label: '注册用户', value: userActivity?.total_registered ?? statsData.patientStats?.total_patients ?? 0, color: '#2563EB', gradient: 'linear-gradient(90deg,#2563EB,#60A5FA)', sub: `今日活跃 ${userActivity?.daily_active ?? 0}` },
|
||||
{ label: '业务模块', value: `${activeModules} / ${totalModules}`, color: '#7C3AED', gradient: 'linear-gradient(90deg,#7C3AED,#A78BFA)', sub: `${totalModules - activeModules} 个插件待启用` },
|
||||
{ label: '今日操作', value: auditLogs.length, color: '#16A34A', gradient: 'linear-gradient(90deg,#16A34A,#4ADE80)', sub: 'API 请求 · 0 错误' },
|
||||
{ label: '业务模块', value: `${activeModules} / ${totalModules}`, color: '#7C3AED', gradient: 'linear-gradient(90deg,#7C3AED,#A78BFA)', sub: totalModules > 0 ? `${totalModules - activeModules} 个插件待启用` : '加载中...' },
|
||||
{ label: '今日操作', value: userActivity?.daily_active ?? 0, color: '#16A34A', gradient: 'linear-gradient(90deg,#16A34A,#4ADE80)', sub: `近 ${auditLogs.length} 条记录` },
|
||||
{ label: '本周活跃', value: userActivity?.weekly_active ?? 0, color: '#EA580C', gradient: 'linear-gradient(90deg,#EA580C,#FB923C)', sub: `月活 ${userActivity?.monthly_active ?? 0}` },
|
||||
];
|
||||
|
||||
const healthServices = systemHealth?.services ?? [
|
||||
{ name: 'API 服务', status: 'healthy', message: '检测中...', response_ms: null },
|
||||
{ name: '数据库', status: 'healthy', message: '检测中...', response_ms: null },
|
||||
{ name: '定时任务', status: 'healthy', message: '检测中...', response_ms: null },
|
||||
{ name: 'API 服务', status: 'unknown' as const, message: '数据加载中...', response_ms: null },
|
||||
{ name: '数据库', status: 'unknown' as const, message: '数据加载中...', response_ms: null },
|
||||
{ name: '定时任务', status: 'unknown' as const, message: '数据加载中...', response_ms: null },
|
||||
];
|
||||
|
||||
const userActivityItems = [
|
||||
|
||||
@@ -65,7 +65,7 @@ export default function OperatorWorkbench() {
|
||||
className="erp-fade-in">
|
||||
<div style={{ position: 'absolute', top: -30, right: -30, width: 150, height: 150, background: 'rgba(255,255,255,0.06)', borderRadius: '50%' }} />
|
||||
<div style={{ position: 'absolute', bottom: -50, left: '25%', width: 200, height: 200, background: 'rgba(255,255,255,0.04)', borderRadius: '50%' }} />
|
||||
<div style={{ fontSize: 14, opacity: 0.85, marginBottom: 4, position: 'relative', zIndex: 1 }}>{greeting},{firstName.charAt(0)}美玲。AI 帮你梳理了今天的运营重点:</div>
|
||||
<div style={{ fontSize: 14, opacity: 0.85, marginBottom: 4, position: 'relative', zIndex: 1 }}>{greeting},{firstName}。AI 帮你梳理了今天的运营重点:</div>
|
||||
<div style={{ fontSize: 20, fontWeight: 700, marginBottom: 14, position: 'relative', zIndex: 1 }}>{stats?.total_pending ?? 0} 个运营洞察需要关注</div>
|
||||
<div style={{ fontSize: 13, lineHeight: 2, opacity: 0.92, position: 'relative', zIndex: 1 }}>
|
||||
<b style={{ color: '#FED7AA', fontWeight: 600 }}>1. 积分兑换活动数据</b> — 今日发放 {statsData.pointsStats?.total_issued ?? 0} 积分,消费 {statsData.pointsStats?.total_spent ?? 0}。<br />
|
||||
|
||||
Reference in New Issue
Block a user