diff --git a/beike/Helpers.php b/beike/Helpers.php index 1b3c0d6f..597012f8 100644 --- a/beike/Helpers.php +++ b/beike/Helpers.php @@ -107,18 +107,6 @@ function shop_route($route, $params = []): string return route('shop.' . $route, $params); } -/** - * 获取插件链接 - * - * @param $route - * @param mixed $params - * @return string - */ -function plugin_route($route, $params = []): string -{ - return route('plugin.' . $route, $params); -} - /** * 获取 category, product, brand, page, static, custom 路由链接 * diff --git a/beike/Shop/Providers/PluginServiceProvider.php b/beike/Shop/Providers/PluginServiceProvider.php index 13a6d3d5..25492da7 100644 --- a/beike/Shop/Providers/PluginServiceProvider.php +++ b/beike/Shop/Providers/PluginServiceProvider.php @@ -99,7 +99,7 @@ class PluginServiceProvider extends ServiceProvider $pluginBasePath = $this->pluginBasePath; $shopRoutePath = "{$pluginBasePath}/{$pluginCode}/Routes/shop.php"; if (file_exists($shopRoutePath)) { - Route::prefix('plugin') + Route::name('shop.') ->middleware('shop') ->group(function () use ($shopRoutePath) { $this->loadRoutesFrom($shopRoutePath); diff --git a/plugins/LatestProducts/Bootstrap.php b/plugins/LatestProducts/Bootstrap.php index d00160d1..3cb2dba2 100644 --- a/plugins/LatestProducts/Bootstrap.php +++ b/plugins/LatestProducts/Bootstrap.php @@ -35,7 +35,7 @@ class Bootstrap add_filter('menu.content', function ($data) { $data[] = [ 'name' => trans('LatestProducts::header.latest_products'), - "link" => plugin_route('latest_products'), + "link" => shop_route('latest_products'), ]; return $data; }, 0); diff --git a/plugins/LatestProducts/Routes/shop.php b/plugins/LatestProducts/Routes/shop.php index 2e132b6d..9bf997cb 100644 --- a/plugins/LatestProducts/Routes/shop.php +++ b/plugins/LatestProducts/Routes/shop.php @@ -12,4 +12,4 @@ use Illuminate\Support\Facades\Route; use Plugin\LatestProducts\Controllers\MenusController; -Route::get('/latest_products', [MenusController::class, 'latestProducts'])->name('plugin.latest_products'); +Route::get('/latest_products', [MenusController::class, 'latestProducts'])->name('latest_products'); diff --git a/plugins/Paypal/Views/checkout/payment.blade.php b/plugins/Paypal/Views/checkout/payment.blade.php index a0b0406f..faa7f890 100644 --- a/plugins/Paypal/Views/checkout/payment.blade.php +++ b/plugins/Paypal/Views/checkout/payment.blade.php @@ -14,7 +14,7 @@ // Call your server to set up the transaction createOrder: function (data, actions) { const token = $('meta[name="csrf-token"]').attr('content') - return fetch('/plugin/paypal/create', { + return fetch('/paypal/create', { method: 'POST', headers: { 'X-CSRF-Token': token @@ -43,7 +43,7 @@ // Call your server to finalize the transaction onApprove: function (data, actions) { const token = $('meta[name="csrf-token"]').attr('content') - return fetch('/plugin/paypal/capture', { + return fetch('/paypal/capture', { method: 'POST', headers: { 'X-CSRF-Token': token diff --git a/plugins/Social/Controllers/ShopSocialController.php b/plugins/Social/Controllers/ShopSocialController.php index 6033f6a4..37dd4648 100644 --- a/plugins/Social/Controllers/ShopSocialController.php +++ b/plugins/Social/Controllers/ShopSocialController.php @@ -31,7 +31,7 @@ class ShopSocialController extends Controller $config = [ 'client_id' => $providerSetting['key'], 'client_secret' => $providerSetting['secret'], - 'redirect' => plugin_route('social.callback', $provider), + 'redirect' => shop_route('social.callback', $provider), ]; Config::set("services.{$provider}", $config); } diff --git a/plugins/Social/Routes/shop.php b/plugins/Social/Routes/shop.php index 27bcbaca..50f26314 100644 --- a/plugins/Social/Routes/shop.php +++ b/plugins/Social/Routes/shop.php @@ -12,5 +12,5 @@ use Illuminate\Support\Facades\Route; use Plugin\Social\Controllers\ShopSocialController; -Route::get('/social/redirect/{provider}', [ShopSocialController::class, 'redirect'])->name('plugin.social.redirect'); -Route::get('/social/callbacks/{provider}', [ShopSocialController::class, 'callback'])->name('plugin.social.callback'); +Route::get('/social/redirect/{provider}', [ShopSocialController::class, 'redirect'])->name('social.redirect'); +Route::get('/social/callbacks/{provider}', [ShopSocialController::class, 'callback'])->name('social.callback'); diff --git a/plugins/Social/Views/admin/config.blade.php b/plugins/Social/Views/admin/config.blade.php index 8283af6c..ba7b338d 100644 --- a/plugins/Social/Views/admin/config.blade.php +++ b/plugins/Social/Views/admin/config.blade.php @@ -173,13 +173,13 @@ }, providerChange(e, index) { - this.form.social[index].callback = `{{ shop_route('home.index') }}/plugin/social/callbacks/${e}` + this.form.social[index].callback = `{{ shop_route('home.index') }}/social/callbacks/${e}` }, addRow() { let providers = this.source.providers.filter(e => !this.form.social.some(s => s.provider == e.code)) if (providers.length) { - this.form.social.push({provider: providers[0].code, status: 1, key: '', secret: '', callback: `{{ shop_route('home.index') }}/plugin/social/callbacks/${this.source.providers[0].code}`, sort_order: this.form.social.length}) + this.form.social.push({provider: providers[0].code, status: 1, key: '', secret: '', callback: `{{ shop_route('home.index') }}/social/callbacks/${this.source.providers[0].code}`, sort_order: this.form.social.length}) } }, diff --git a/plugins/Social/Views/shop/social_button.blade.php b/plugins/Social/Views/shop/social_button.blade.php index 61b0c536..dcd250d1 100644 --- a/plugins/Social/Views/shop/social_button.blade.php +++ b/plugins/Social/Views/shop/social_button.blade.php @@ -1,4 +1,4 @@ - diff --git a/plugins/Stripe/Routes/shop.php b/plugins/Stripe/Routes/shop.php index e9a9e470..fdf208ca 100644 --- a/plugins/Stripe/Routes/shop.php +++ b/plugins/Stripe/Routes/shop.php @@ -12,4 +12,4 @@ use Illuminate\Support\Facades\Route; use Plugin\Stripe\Controllers\StripeController; -Route::post('/stripe/capture', [StripeController::class, 'capture'])->name('plugin.stripe_capture'); +Route::post('/stripe/capture', [StripeController::class, 'capture'])->name('stripe_capture'); diff --git a/plugins/Stripe/Views/checkout/payment.blade.php b/plugins/Stripe/Views/checkout/payment.blade.php index 51a4e893..3f25eb8d 100644 --- a/plugins/Stripe/Views/checkout/payment.blade.php +++ b/plugins/Stripe/Views/checkout/payment.blade.php @@ -98,7 +98,7 @@ return; } - $http.post(`/plugin/stripe/capture`, this.form).then((res) => { + $http.post(`/stripe/capture`, this.form).then((res) => { layer.msg(res.message) console.log(res) location = "{{ shop_route('account.order.show', ['number' => $order->number]) }}"