|
@@ -1,5 +1,6 @@
|
|
<?php
|
|
<?php
|
|
|
|
|
|
|
|
+use App\Models\DistProduct;
|
|
use Illuminate\Support\Facades\Route;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
|
|
use App\Http\Controllers\HomeController;
|
|
use App\Http\Controllers\HomeController;
|
|
@@ -11,6 +12,8 @@ use App\Http\Controllers\DemoController;
|
|
use App\Http\Controllers\SitemapController;
|
|
use App\Http\Controllers\SitemapController;
|
|
use App\Http\Controllers\CollectionController;
|
|
use App\Http\Controllers\CollectionController;
|
|
|
|
|
|
|
|
+use App\Models\DistProductCategory;
|
|
|
|
+
|
|
/*
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
|--------------------------------------------------------------------------
|
|
| Web Routes
|
|
| Web Routes
|
|
@@ -21,6 +24,32 @@ use App\Http\Controllers\CollectionController;
|
|
| be assigned to the "web" middleware group. Make something great!
|
|
| be assigned to the "web" middleware group. Make something great!
|
|
|
|
|
|
|
|
*/
|
|
*/
|
|
|
|
+
|
|
|
|
+//巴西官网专用路由
|
|
|
|
+$host = $_SERVER['HTTP_HOST']; // 获取当前域名
|
|
|
|
+if ($host == 'internal-dist.mietubl.com.cn') {
|
|
|
|
+ Route::get('/{slug}', function ($slug) {
|
|
|
|
+ // 查询数据库,将 category_slug 转换为对应ID
|
|
|
|
+ $categoryId = DistProductCategory::where('slug',$slug)
|
|
|
|
+ ->where('dist_id', getDistId())
|
|
|
|
+ ->firstOrFail();
|
|
|
|
+ if ($categoryId) {
|
|
|
|
+ return redirect()->route('products.categories', ['slug' => $categoryId]);
|
|
|
|
+ } else {
|
|
|
|
+ $product = DistProduct::getProductSlug($slug);
|
|
|
|
+ if ($product) {
|
|
|
|
+ return redirect()->route('products.detail', ['id' => $product->id]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ Route::get('/produto/{slug}', function ($slug) {
|
|
|
|
+ return redirect()->route('products.detail', ['id' => $slug]);
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
Route::get('/demo', [DemoController::class, 'index'])->name('demo');
|
|
Route::get('/demo', [DemoController::class, 'index'])->name('demo');
|
|
|
|
|
|
|
|
|
|
@@ -66,9 +95,5 @@ Route::get('/sitemap.xml', [SitemapController::class, 'index'])->name('sitemap.i
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-// 产品路由
|
|
|
|
-Route::prefix('produto')->group(function () {
|
|
|
|
- Route::get('/', [ProductController::class, 'index'])->name('products.index');
|
|
|
|
- Route::get('/{id}', [ProductController::class, 'detail'])->name('products.detail');
|
|
|
|
- Route::get('/categories/{categoryId}', [ProductController::class, 'category'])->name('products.category');
|
|
|
|
-});
|
|
|
|
|
|
+
|
|
|
|
+
|