fix(health+server+mp): 审计 P0 批次修复 — 积分冲突/文章草稿泄露/商城空白/模板ID配置化
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled

P0-1: 微信模板 ID 从硬编码空字符串改为环境变量注入
  - wechat-templates.ts 读取 process.env.TARO_APP_WX_TEMPLATE_*
  - defineConstants 新增 5 个模板 ID 编译时注入

P0-2: 积分商城 Tab 空白降级
  - mall/index.tsx 在 currentPatient 为 null 时先调用 loadPatients()
  - 仍无档案才显示空状态引导,而非直接阻断

P0-3: 消除 erp-points 重复路由冲突
  - 从 erp-server 移除 erp-points 模块注册和路由 merge
  - 积分功能统一由 erp-health /health/points/* 提供
  - erp-points crate 保留但不参与编译

P0-4: 文章列表按角色过滤防止草稿泄露
  - list_articles handler: 非管理权限强制 status=published
  - get_article service: 新增 is_admin 参数控制状态过滤
This commit is contained in:
iven
2026-04-29 15:11:05 +08:00
parent facc8b0d24
commit dffa2dd47d
9 changed files with 46 additions and 39 deletions

View File

@@ -22,7 +22,7 @@ const TYPE_BG: Record<string, string> = {
};
export default function Mall() {
const { currentPatient } = useAuthStore();
const { currentPatient, loadPatients } = useAuthStore();
const { account, checkinStatus, refresh: refreshPoints, doCheckin } = usePointsStore();
const [products, setProducts] = useState<PointsProduct[]>([]);
const [productType, setProductType] = useState('');
@@ -66,13 +66,18 @@ export default function Mall() {
async (type?: string) => {
const t = type !== undefined ? type : productType;
if (!currentPatient) {
setNoProfile(true);
return;
// 先尝试从服务端加载患者列表
await loadPatients();
const updated = useAuthStore.getState().currentPatient;
if (!updated) {
setNoProfile(true);
return;
}
}
setNoProfile(false);
await Promise.all([refreshPoints(), fetchProducts(1, t, true)]);
},
[currentPatient, refreshPoints, fetchProducts, productType],
[currentPatient, loadPatients, refreshPoints, fetchProducts, productType],
);
useDidShow(() => {