<?php
/**
 * Created by PhpStorm.
 * User: hp
 * Date: 2017/11/20
 * Time: 15:59
 */

Route::group(['domain'=>env('CHANNEL_DOMAIN'),'namespace'=>'App\Http\Controllers\Channel\Channel','prefix'=>'api'],function () {
    
    //登陆相关 无须登录校验
    Route::post('auth/sms','AuthController@sms');
    Route::post('auth/register','AuthController@register');
    Route::post('auth/login','AuthController@login');
    Route::post('auth/retrieveSms','AuthController@retrieveSms');//找回密码短信下发
    Route::post('auth/retrieve','AuthController@retrieve');//找回密码
    Route::get('auth/captcha','AuthController@getCaptcha');
    Route::get('auth/test2','AuthController@test2');

    Route::group(['middleware'=>'ChannelApiAuth'],function (){
        //修改密码需登录
        Route::post('auth/modifyPassword','AuthController@modifyPassword')->middleware('ChannelOperateRecord');

        //设置当前渠道
        Route::post('channel/setCurrent','ChannelController@setCurrent')->middleware('ChannelOperateRecord');
        //创建渠道
        Route::post('channel/create','ChannelController@createChannel')->middleware('ChannelOperateRecord');
        //获取账号下渠道列表
        Route::get('channels','ChannelController@channelList')->middleware('ChannelOperateRecord');
        //删除站点
        Route::get('channel/deleteChannel','ChannelController@deleteChannel')->middleware('ChannelOperateRecord');
        //设置外站开关
        Route::any('channel/updateDistributionOuterSiteSwitch','ChannelController@updateDistributionOuterSiteSwitch')->middleware('ChannelOperateRecord');
        //设置新老用户站点开关
        Route::any('channel/updateDistributionOldUserSiteSwitch','ChannelController@updateDistributionOldUserSiteSwitch')->middleware('ChannelOperateRecord');
        //获取渠道信息
        Route::any('channel/getDistributionChannel','ChannelController@getDistributionChannel');
        // 获取当前渠道某个分类的开关
        Route::any('channel/getDistributionChannelSwitchByCategory','ChannelController@getDistributionChannelSwitchByCategory');
        
        //获取支付列表类型
        Route::get('channels/getPayTemplate','PayTemplateController@getPayTemplate')->middleware('ChannelOperateRecord');
        //设置支付列表类型
        Route::post('channels/setPayTemplate','PayTemplateController@setPayTemplate')->middleware('ChannelOperateRecord');


        //设置站点别名
        Route::post('channels/setsitename','ChannelController@setSiteNickName')->middleware('ChannelOperateRecord');
        //获取强关配置
        Route::get('channels/getSubscribeSetting','ChannelSubscribeSettingController@getSubscribeSetting')->middleware('ChannelOperateRecord');
        //设置强关配置
        Route::any('channels/setSubscribeType','ChannelSubscribeSettingController@setSubscribeType')->middleware('ChannelOperateRecord');
        //代付开关
        Route::any('channels/getChannelPaySubstituteSwitch','ChannelSwitchController@getChannelPaySubstituteSwitch');
        Route::any('channels/setChannelPaySubstituteSwitch','ChannelSwitchController@setChannelPaySubstituteSwitch');

        //提交渠道问卷调查
        Route::post('channel/addQuestionNaire', 'ChannelQuestionNaireController@add_question_naire');
        Route::post('channel/checkQuestionNaireShow', 'ChannelQuestionNaireController@checkQuestionNaireShow');
        Route::post('channel/setQuestionNaireShowed', 'ChannelQuestionNaireController@setQuestionNaireShowed');
    });


});
