PlatformOrder create: autofill merchant/plan from subscription defaults
This commit is contained in:
@@ -56,6 +56,17 @@ class PlatformOrderController extends Controller
|
||||
$siteSubscription = SiteSubscription::query()->with(['merchant', 'plan'])->find($siteSubscriptionId);
|
||||
}
|
||||
|
||||
// 续费下单场景:若带了 site_subscription_id,但未显式指定 merchant/plan,则从订阅上补齐默认值。
|
||||
// 目的:让“从订阅维度跳转到下单页”的链路更稳,不必每次手工二次选择。
|
||||
if ($siteSubscription) {
|
||||
if ((int) ($defaults['merchant_id'] ?? 0) <= 0) {
|
||||
$defaults['merchant_id'] = (int) ($siteSubscription->merchant_id ?? 0);
|
||||
}
|
||||
if ((int) ($defaults['plan_id'] ?? 0) <= 0) {
|
||||
$defaults['plan_id'] = (int) ($siteSubscription->plan_id ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
return view('admin.platform_orders.form', [
|
||||
'merchants' => $merchants,
|
||||
'plans' => $plans,
|
||||
|
||||
Reference in New Issue
Block a user