From 44feb7b0f5bd06f1977a9006d837935a57abf9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sun, 4 Oct 2026 10:33:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3(=E4=BC=9A=E5=91=98=E5=90=8E?= =?UTF-8?q?=E5=8F=B0)=EF=BC=9A=E7=BC=BA=E5=B0=91=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E6=A1=A3=E4=BD=8D=E6=97=B6=E4=B8=8D=E5=86=8D=E5=9B=9E=E9=80=80?= =?UTF-8?q?=20rank=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - upsert 解析 rank 失败改为显式报错,避免与 Normal 占位同档 - 与 module-runtime 用 Option 暴露缺失档位的契约保持一致 --- .../spacetime-module/src/runtime/active/profile.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server-rs/crates/spacetime-module/src/runtime/active/profile.rs b/server-rs/crates/spacetime-module/src/runtime/active/profile.rs index 2d25e248a..fff05e9dd 100644 --- a/server-rs/crates/spacetime-module/src/runtime/active/profile.rs +++ b/server-rs/crates/spacetime-module/src/runtime/active/profile.rs @@ -8383,9 +8383,15 @@ fn upsert_profile_membership_plan_record( .plan() .find(&validated.plan); // 代码内目录是 `rank` 的唯一来源:后台改价、改权益、改上下架都不会动升级比较基准。 + // 缺失档位必须显式报错:回退成 rank 0 会与 Normal 占位同档,产生误导性的校验结果。 let rank = resolve_runtime_profile_membership_plan_row(validated.plan) - .map(|row| row.rank) - .unwrap_or(0); + .ok_or_else(|| { + format!( + "会员目录缺少档位 {},无法解析升级比较基准", + validated.plan.as_str() + ) + })? + .rank; let inserted = ProfileMembershipPlan { plan: validated.plan,