<?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!
|
*/

Route::get('/', function () {
    return view('welcome');
});
Route::get('/phpstorage/{path}', function ($path) {
    $disk = \Illuminate\Support\Facades\Storage::disk('network_drive');

    try {
        if (!$disk->exists($path)) {
            abort(404);
        }

        $contents = $disk->get($path);
        $mimeType = $disk->mimeType($path);

        return response($contents, 200)
            ->header('Content-Type', $mimeType ?: 'application/octet-stream');
    } catch (\Exception $e) {
        abort(404);
    }
})->where('path', '.*');

//微信登录授权获取code
Route::get('/wxLogin/{env}', function ($env) {
    $redirectUrl=urlencode(config('app.globals.WxRedirectUrl'));
    $url="https://open.weixin.qq.com/connect/oauth2/authorize?appid=".config('app.globals.WxAppid')."&redirect_uri=".$redirectUrl."&response_type=code&scope=snsapi_base&state=".$env."#wechat_redirect";
    return redirect($url);
});
//微信登录授权获取openid
Route::get('/wxGetCode','App\Http\Controllers\API\mH5\LoginController@wxGetCode' );
Route::any('/test','App\Http\Controllers\TestController@DBtest' );
Route::any('/mm_test','App\Http\Controllers\TestController@mm_test' );
Route::any('/gongweitest', function () {
    return view('gongweitest');
});
Route::any('/lqs_test','App\Http\Controllers\TestController@lqs_test' );
Route::any('/yuju_test', function () { //测试 语句
    return view('yuju_test');
});


Route::any('/pljm','App\Http\Controllers\TestController@jiami' );
Route::any('/jiemage','App\Http\Controllers\TestController@jiemi_age' );

// 记录查询路由
Route::get('/record/query', 'App\Http\Controllers\RecordQueryController@index')->name('record.index');
Route::post('/record/query', 'App\Http\Controllers\RecordQueryController@query')->name('record.query');
Route::post('/record/export', 'App\Http\Controllers\RecordQueryController@export')->name('record.export');
