149 lines
5.6 KiB
PHP
149 lines
5.6 KiB
PHP
<?php
|
|
$admin_path = 'agent/admin';
|
|
try {
|
|
$admin_path = config_cache('config.merchant_path');
|
|
if (!$admin_path) {
|
|
$admin_path = 'agent/admin';
|
|
}
|
|
} catch (Exception $exception) {
|
|
$admin_path = 'agent/admin';
|
|
}
|
|
|
|
Route::prefix($admin_path)->name('merchant.admin.')->group(function ($route) {
|
|
|
|
$route->get('/', ['middleware' => 'throttle:30,1', 'uses' => 'LoginController@showLoginForm'])->name('login');
|
|
$route->post('login', 'LoginController@login')->name('post.login');
|
|
$route->get('logout', 'LoginController@logout')->name('logout');
|
|
$route->post('send/sendsms', 'SendSmsController@code')->name('api.code');
|
|
|
|
|
|
Route::group(['middleware' => 'merchants'], function () {
|
|
Route::group(['prefix' => 'home'], function () {
|
|
Route::get('/', 'HomeController@index')->name('admin.home');
|
|
Route::get('console', 'HomeController@console');
|
|
Route::get('show/{type}/{id}', 'HomeController@show');
|
|
Route::any('update/{method}', 'HomeController@update');
|
|
});
|
|
|
|
/**********************操作相关***********************/
|
|
|
|
//api
|
|
Route::get('api/{type}/{name}', 'ApiController@index');
|
|
//统计
|
|
Route::get('statis/{type}', 'StatisController@index');
|
|
Route::post('handle/{type}', ['uses' => 'HandleController@handle']);
|
|
//图片上传
|
|
Route::any('upload/{type}', ['uses' => 'FileUploadController@handle']);
|
|
|
|
/**********************操作相关***********************/
|
|
|
|
|
|
/**********************只需要首页路由控制***********************/
|
|
$only_index = [
|
|
'LogController',
|
|
'MerchantMoneyLogController',
|
|
'MerchantCommissionController',
|
|
'MerchantMoneyLogController',
|
|
'OrderController',
|
|
'OrderHandleApiController',
|
|
|
|
];
|
|
foreach ($only_index as $c) {
|
|
//自动获取
|
|
$controller = str_replace('Controller', '', $c);
|
|
$controller_path = strtolower($controller);
|
|
Route::get($controller_path, $c . '@index');
|
|
//列表json
|
|
Route::any($controller_path . '/api/json', ['uses' => $c . '@apiJson']);
|
|
|
|
if (in_array($c, ['OrderController', 'PayForController'])) {
|
|
Route::get($controller_path . '/show/{id}', ['uses' => $c . '@show']);
|
|
|
|
}
|
|
|
|
if (in_array($c, ['OrderHandleApiController'])) {
|
|
//订单处理
|
|
Route::get($controller_path . '/handle/{order_id}/{type}', 'OrderHandleApiController@handle');
|
|
Route::post($controller_path . '/handle/post/{order_id}/{type}', 'OrderHandleApiController@handlePost');
|
|
}
|
|
|
|
}
|
|
|
|
/**********************资源路由控制***********************/
|
|
//资源url
|
|
$resource = [
|
|
'MerchantController',
|
|
'BankRelController',
|
|
'DrawMoneyController',
|
|
'MerchantRegistTokenController',
|
|
'MerchantRegistController',
|
|
|
|
|
|
];
|
|
foreach ($resource as $c) {
|
|
//自动获取
|
|
$controller = str_replace('Controller', '', $c);
|
|
$controller_path = strtolower($controller);
|
|
|
|
//Route::resource($controller_path, $c);
|
|
Route::get($controller_path,$c.'@index')->name($controller_path.'index');
|
|
Route::get($controller_path.'/create',$c.'@create')->name($controller_path.'create');
|
|
Route::post($controller_path,$c.'@store')->name($controller_path.'store');
|
|
Route::get($controller_path.'/{id}',$c.'@show')->name($controller_path.'show');
|
|
Route::get($controller_path.'/{id}/edit',$c.'@edit')->name($controller_path.'edit');
|
|
Route::put($controller_path.'/{id}',$c.'@update')->name($controller_path.'update');
|
|
Route::delete($controller_path.'/{id}',$c.'@destroy')->name($controller_path.'destroy');
|
|
//主持列表json
|
|
Route::any($controller_path . '/api/json', ['uses' => $c . '@apiJson']);
|
|
|
|
}
|
|
|
|
/**********************类型资源路只需要首页***********************/
|
|
//类型只需要首页
|
|
$type_controller = [
|
|
|
|
|
|
];
|
|
foreach ($type_controller as $c) {
|
|
//自动获取
|
|
$controller = str_replace('Controller', '', $c);
|
|
$controller_path = strtolower($controller);
|
|
Route::group(['prefix' => $controller_path . '/{group_type}'], function () use ($c) {
|
|
Route::get('/', $c . '@index');
|
|
Route::any('/api/json', ['uses' => $c . '@apiJson']);
|
|
//回复评论
|
|
if ($c == 'ShopCommentController') {
|
|
Route::post('/{id}/{type}', ['uses' => 'ShopCommentController@handle']);
|
|
}
|
|
});
|
|
|
|
}
|
|
//资源更新删除操作
|
|
$type_controller2 = [
|
|
|
|
];
|
|
|
|
/**********************资源类型路由控制***********************/
|
|
foreach ($type_controller2 as $c) {
|
|
//自动获取
|
|
$controller = str_replace('Controller', '', $c);
|
|
$controller_path = strtolower($controller);
|
|
|
|
Route::group(['prefix' => $controller_path . '/{group_type}'], function () use ($c) {
|
|
Route::get('/', $c . '@index');
|
|
Route::get('create', $c . '@create');
|
|
Route::post('store', $c . '@store');
|
|
Route::get('{id}/edit/', $c . '@edit');
|
|
Route::put('{id}', $c . '@update');
|
|
Route::any('/api/json', ['uses' => $c . '@apiJson']);
|
|
|
|
});
|
|
|
|
}
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|