PlatformOrder store: require subscription for renewal orders
This commit is contained in:
@@ -78,8 +78,7 @@ class PlatformOrderController extends Controller
|
||||
'plans' => $plans,
|
||||
'siteSubscription' => $siteSubscription,
|
||||
'billingCycleLabels' => $this->billingCycleLabels(),
|
||||
// order_type label 映射已下沉到 PlatformOrder::orderTypeLabel();这里不再透传 orderTypeLabels
|
||||
// 'orderTypeLabels' => $this->orderTypeLabels(),
|
||||
'orderTypeLabels' => $this->orderTypeLabels(),
|
||||
'defaults' => $defaults,
|
||||
]);
|
||||
}
|
||||
@@ -91,7 +90,13 @@ class PlatformOrderController extends Controller
|
||||
$data = $request->validate([
|
||||
'merchant_id' => ['required', 'integer', 'exists:merchants,id'],
|
||||
'plan_id' => ['required', 'integer', 'exists:plans,id'],
|
||||
'site_subscription_id' => ['nullable', 'integer', 'exists:site_subscriptions,id'],
|
||||
// 治理口径:续费单必须绑定订阅(否则无法做到“续期/延长到期”这一核心闭环)
|
||||
'site_subscription_id' => [
|
||||
Rule::requiredIf(fn () => (string) $request->input('order_type') === 'renewal'),
|
||||
'nullable',
|
||||
'integer',
|
||||
'exists:site_subscriptions,id',
|
||||
],
|
||||
'order_type' => ['required', Rule::in(array_keys($this->orderTypeLabels()))],
|
||||
'quantity' => ['required', 'integer', 'min:1', 'max:120'],
|
||||
'discount_amount' => ['nullable', 'numeric', 'min:0'],
|
||||
|
||||
Reference in New Issue
Block a user