<?php

namespace App\Providers;

use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;

class RouteServiceProvider extends ServiceProvider
{
    /**
     * This namespace is applied to your controller routes.
     *
     * In addition, it is set as the URL generator's root namespace.
     *
     * @var string
     */
    protected $namespace = 'App\Http\Controllers';

    /**
     * Define your route model bindings, pattern filters, etc.
     *
     * @param  \Illuminate\Routing\Router $router
     * @return void
     */
    public function boot()
    {
        //

        parent::boot();
    }

    /**
     * Define the routes for the application.
     *
     * @param  \Illuminate\Routing\Router $router
     * @return void
     */
    public function map(Router $router)
    {
        $this->mapPayRoutes($router);
        $this->mapActivityRoutes($router);
        $this->mapNoticeRoutes($router);
        $this->mapFinanceRoutes($router);
        $this->mapBookRoutes($router);
        $this->mapUserRoutes($router);
        $this->mapChannelRoutes($router);
        $this->mapManageRoutes($router);
        $this->mapForceSubRoutes($router);//新增强关数据
        $this->mapChargeRoutes($router);
        $this->mapCpRoutes($router);
        $this->mapSendOrderRoutes($router);
        $this->mapPromotionRoutes($router);
        $this->mapBadInfoRoutes($router);//敏感词
        $this->mapTradeRoutes($router);
        $this->mapOfficialAccountRoutes($router);
        $this->mapWapRoutes($router);
        $this->mapChannelOfficialAccountRoutes($router);
        $this->mapUserAndUserOrderRoutes($router);
        $this->mapWelfareRoutes($router);
        $this->mapXcxRoutes($router);
        $this->mapAliRoutes($router);
        $this->mapWebRoutes($router);
        

        $this->mapXchengyuRoutes($router);
        $this->mapAgentsRoutes($router);
    }


    protected function mapNoticeRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Channel/NoticeRoutes.php');
            require app_path('Http/Routes/Manage/NoticeRoutes.php');
        });
    }

    protected function mapFinanceRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Channel/FinanceRoutes.php');
            require app_path('Http/Routes/Manage/FinanceRoutes.php');
        });
    }

    protected function mapBookRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Manage/BookRoutes.php');
            require app_path('Http/Routes/Channel/BookRoutes.php');
            require app_path('Http/Routes/Cp/BookRoutes.php');
        });
    }

    protected function mapUserRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Manage/UserRoutes.php');
        });
    }

    protected function mapChargeRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Manage/ChargeRoutes.php');
        });
    }

    protected function mapPromotionRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Channel/PromotionRoutes.php');
        });
    }

    protected function mapSendOrderRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Channel/SendOrderRoutes.php');
            require app_path('Http/Routes/Manage/SendOrderRoutes.php');
        });
    }

    protected function mapChannelRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Channel/ChannelRoutes.php');
            require app_path('Http/Routes/Manage/ChannelRoutes.php');
        });
    }

    protected function mapManageRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Manage/ManageRoutes.php');
            require app_path('Http/Routes/Cp/ManageRoutes.php');
            require app_path('Http/Routes/Manage/HelpRoutes.php');
            require app_path('Http/Routes/Manage/RecoBookRoutes.php');
        });
    }
    protected function mapForceSubRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Manage/ForceSubRoutes.php');
        });
    }
    protected function mapPayRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Manage/PayRoutes.php');
        });
    }

    protected function mapTradeRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Channel/TradeRoutes.php');
            require app_path('Http/Routes/Manage/TradeRoutes.php');
        });
    }

    protected function mapOfficialAccountRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Wap/OfficialAccountRoutes.php');
            require app_path('Http/Routes/Manage/OfficialAccountRoutes.php');
        });
        $router->group([
            'middleware' => 'wap',
        ], function ($router) {
            require app_path('Http/Routes/Wechat/OfficialAccountRoutes.php');
        });
    }
    
    protected function mapCpRoutes(Router $router)
    {
    	$router->group([
    			'middleware' => 'web',
    			], function ($router) {
    
    		require app_path('Http/Routes/Manage/CpRoutes.php');
    	});
    }

    protected function mapChannelOfficialAccountRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {

            require app_path('Http/Routes/Channel/OfficialAccountRoutes.php');
        });
    }

    protected function mapActivityRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Manage/ActivityRoutes.php');
            require app_path('Http/Routes/Channel/ActivityRoutes.php');
        });
    }

    //敏感词
    public function mapBadInfoRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Manage/BadInfoRoutes.php');
        });
    }

    /**
     * h5路由
     * @param Router $router
     */
    protected function mapWapRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'wap',
        ], function ($router) {

            require app_path('Http/Routes/Wap/WapRoutes.php');
        });
    }

    //UI界面
    protected function mapWebRoutes(Router $router)

    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {

            require app_path('Http/Routes/Channel/WebRoutes.php');
            require app_path('Http/Routes/Manage/WebRoutes.php');
            require app_path('Http/Routes/Cp/WebRoutes.php');
            require app_path('Http/Routes/WapBrower/WebRoutes.php');

        });
    }

    //分销用户信息和用户订单
    public function mapUserAndUserOrderRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {

            require app_path('Http/Routes/Channel/UserRoutes.php');
            require app_path('Http/Routes/Channel/OrderRoutes.php');

        });
    }

    //分销支付宝路由
    public function mapAliRoutes(Router $router)
    {
    	$router->group([
    			'middleware' => 'web',
    			], function ($router) {
    		require app_path('Http/Routes/Channel/AliRoutes.php');
    	});
    }
    //分销小程序路由
    public function mapXcxRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Channel/XcxRoutes.php');
        });
    }
    /**
     * 小程序路由
     * @param Router $router
     */
    protected function mapXchengyuRoutes(Router $router){
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Xchengxu/XchengxuRoutes.php');
        });
    }


    //分销红包路由
    public function mapWelfareRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Channel/WelfareRoutes.php');
        });
    }

    //
    public function mapAgentsRoutes(Router $router)
    {
        $router->group([
            'middleware' => 'web',
        ], function ($router) {
            require app_path('Http/Routes/Agents/AgentsManageRoutes.php');
        });
    }

}
