<?php

/*前台*/
Route::group(['namespace'=>'Frontend', 'middleware'=>'frontend'],function() {
    Route::get('/', 'HomeController@index');
    Route::get('page/{path}.html', 'HomeController@page')->where('path', '[A-Za-z0-9-]+');    //自定义页面
    Route::get('sitemap', 'SitemapController@index');    //网站地图
    Route::get('sitemap/quote', 'SitemapController@quote');    //Iframe网站地图
    Route::get('sitemap.xml', 'SitemapController@xml');    //sitemap.xml
    Route::get('product', 'ProductController@index');            //产品列表
    Route::get('product/{cid}', 'ProductController@lists')->where('cid', '[A-Za-z0-9-]+');       //产品分类列表
    Route::get('product/{id}.html', 'ProductController@details')->where('id', '[A-Za-z0-9-]+');  //产品详细页
    Route::get('search', 'SearchController@index');    //搜索页面
    Route::get('news', 'NewsController@index');         //新闻列表
    Route::get('news/{cid}', 'NewsController@lists')->where('cid', '[A-Za-z0-9-]+');     //新闻分类列表
    Route::get('news/{id}.html', 'NewsController@details')->where('id', '[A-Za-z0-9-]+'); //新闻详情
    Route::get('job', 'JobController@index');         //招聘列表
    Route::get('job/{cid}', 'JobController@lists')->where('cid', '[A-Za-z0-9-]+');    //招聘分类列表
    Route::get('job/{id}.html', 'JobController@details')->where('id', '[A-Za-z0-9-]+'); //招聘详情
    Route::get('video', 'VideoController@index');         //视频列表
    Route::get('video/{cid}', 'VideoController@lists')->where('cid', '[A-Za-z0-9-]+');    //视频分类列表
    Route::get('video/{id}.html', 'VideoController@details')->where('id', '[A-Za-z0-9-]+'); //视频详情
    Route::get('download', 'DownloadController@index');         //下载列表
    Route::get('download/{cid}', 'DownloadController@lists')->where('cid', '[A-Za-z0-9-]+');     //下载分类列表
    Route::get('download/{id}.html', 'DownloadController@details')->where('id', '[A-Za-z0-9-]+');  //下载详情
    Route::get('download/down/{id}', 'DownloadController@down');         //下载文件
    Route::get('message/config', 'MessageController@config');  //获取人机验证配置
    Route::resource('message', 'MessageController');  //在线留言
    Route::post('comment', 'CommentController@store');  //在线评论
    Route::get('case', 'CaseController@index');       //案例列表
    Route::get('case/{cid}', 'CaseController@lists')->where('cid', '[A-Za-z0-9-]+');       //案例分类列表
    Route::get('case/{id}.html', 'CaseController@details')->where('id', '[A-Za-z0-9-]+');  //案例详细页
    Route::get('album', 'AlbumController@index');       //相册列表
    Route::get('album/{cid}', 'AlbumController@lists')->where('cid', '[A-Za-z0-9-]+');       //相册分类列表
    Route::get('album/{id}.html', 'AlbumController@details')->where('id', '[A-Za-z0-9-]+');  //相册详细页
    Route::get('tag', 'TagController@index');            //标签列表
    Route::get('tag/{name}', 'TagController@tag');       //标签结果
    Route::post('eventSend', 'HomeController@eventSend');  //核心事件
    Route::post('service', 'HomeController@service');  //客服记录

    Route::get('about', 'HomeController@about');
    Route::get('contact', 'HomeController@contact');

});

Route::group(['prefix'=>'member', 'namespace'=>'Auth', 'middleware'=>'frontend'],function() {
    Route::get('login', 'LoginController@showLoginForm');
    Route::post('login', 'LoginController@postLogin');
    Route::post('logout', 'LoginController@logout');
    Route::get('register', 'RegisterController@showRegistrationForm');
    Route::post('register', 'RegisterController@register');
    Route::get('password/reset', 'ForgotPasswordController@showLinkRequestForm');
    Route::get('password/reset/{token}', 'ForgotPasswordController@getReset');
    Route::post('password/email', 'ForgotPasswordController@sendResetLinkEmail')->name('member.password.email');
    Route::post('password/reset', 'ForgotPasswordController@postReset')->name('member.password.reset');
});

Route::group(['prefix'=>'member', 'namespace'=>'Member', 'middleware'=>'member'],function() {
    Route::get('/', 'HomeController@index');
    Route::get('change-pwd', 'HomeController@changePwd');
    Route::post('update-pwd', 'HomeController@updatePwd')->name('member.update-pwd');

    Route::get('cart', 'CartController@index');
    Route::delete('cart/{id}', 'CartController@destroy');
    Route::get('shopping', 'CartController@shopping');

    Route::get('order', 'OrderController@index');
    Route::get('order/store', 'OrderController@store');

    Route::get('ajax/{model}', 'AjaxController@lists');
    Route::post('ajax/{model}', 'AjaxController@index');

    Route::resource('address', 'AddressController');

    Route::get('pay', 'PayController@index');
    Route::post('pay/paypal-pay', 'PayController@payPal');
    Route::get('pay/paypal/return', 'PayController@payPalReturn')->name('pay.paypal.return');
    Route::get('pay/paypal/cancel', 'PayController@payPalCancel')->name('pay.paypal.cancel');

    Route::get('payment/{type}/{equip}', 'PayController@payment');
    Route::get('pay/alipay/return', 'PayController@alipayReturn');
    Route::post('pay/qr-code', 'PayController@qrCode');

});

Route::group(['namespace'=>'Member'],function() {
    Route::post('pay/paypal/notify', 'PayController@payPalNotify')->name('pay.paypal.notify');
    Route::post('pay/wechat/notify', 'PayController@wechatNotify');
    Route::post('pay/alipay/notify', 'PayController@notify');
});