PlatformOrder create: force renewal type when subscription context present
This commit is contained in:
@@ -131,10 +131,15 @@
|
||||
$selectedOrderType = 'new_purchase';
|
||||
}
|
||||
|
||||
// 更强治理:若来源页声明 require_subscription=1,且当前未绑定订阅,则不展示 upgrade/downgrade 等类型,避免误用。
|
||||
// 更强治理:
|
||||
// - 若存在订阅上下文(锁定订阅)=> 当前阶段仅允许“续费”类型,避免出现“带订阅ID但非续费”导致语义混乱/误同步。
|
||||
// - 若来源页声明 require_subscription=1 且未绑定订阅 => 仅允许新购(用于兜底展示/引导去选订阅)。
|
||||
$requireSub = (bool) ($requireSubscription ?? false);
|
||||
$allowedTypes = array_keys($orderTypeLabels ?? []);
|
||||
if ($requireSub && ! $canRenew) {
|
||||
if ($hasLockedSubscription) {
|
||||
$allowedTypes = ['renewal'];
|
||||
$selectedOrderType = 'renewal';
|
||||
} elseif ($requireSub && ! $canRenew) {
|
||||
$allowedTypes = ['new_purchase'];
|
||||
}
|
||||
@endphp
|
||||
|
||||
Reference in New Issue
Block a user