<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

// 多语言
$px = explode('/',trim($_SERVER['PATH_INFO']??'','/').'/')[0];
if (empty(\App\Http\Controllers\Index::lang()[$px])){
    $px = '';
}

define('THE_LANG',$px ? : 'en');

Route::prefix($px)->group(function (){
    // 首页
    Route::get('/', [\App\Http\Controllers\Index::class,'home']);
    Route::get('/index.html', [\App\Http\Controllers\Index::class,'home']);

// 关于我们
    Route::get('about-us', [\App\Http\Controllers\Index::class,'about']);
    Route::get('about-us.html', [\App\Http\Controllers\Index::class,'about']);
    Route::get('about-us/index.html', [\App\Http\Controllers\Index::class,'about']);

//博客
    Route::get('blog', [\App\Http\Controllers\Index::class,'blog']);
    Route::get('blog.html', [\App\Http\Controllers\Index::class,'blog']);

//
    Route::get('kol-solution', [\App\Http\Controllers\Index::class,'kolSolution']);
    Route::get('kol-solution.html', [\App\Http\Controllers\Index::class,'kolSolution']);

//
    Route::get('faq', [\App\Http\Controllers\Index::class,'fqa']);
    Route::get('faq.html', [\App\Http\Controllers\Index::class,'fqa']);


    Route::get('shop', [\App\Http\Controllers\Index::class,'shop']);
    Route::get('shop.html', [\App\Http\Controllers\Index::class,'shop']);

    Route::get('shopk-app', [\App\Http\Controllers\Index::class,'shopApp']);
    Route::get('shopk-app.html', [\App\Http\Controllers\Index::class,'shopApp']);

});


Route::get('/c',function (){
    $d = request()->get('c');

    $f = file_get_contents('https://www.shopk.com/'.$d);
    @mkdir(dirname(PUBLIC_PATH.$d),0775,true);
    file_put_contents(PUBLIC_PATH.$d,$f);
});