<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$api = app('Dingo\Api\Routing\Router');

$api->version('v1', [
    'namespace' => 'App\Http\Controllers\V1',
], function ($api) {

    //根据行为标识查询行为
    $api->get('getBehaviorByIdentify', 'BehaviorController@getBehaviorByIdentify');
    $api->get('getVodUploadAuth', 'AliYunVodController@getVodUploadAuth');
    $api->get('vod/upload/image', 'AliYunVodController@getImgUploadAuth');
    $api->get('getPlayUrlByVideoId', 'AliYunVodController@getPlayUrlByVideoId');
    //获取所有行为
    $api->get('getAllBehavior', 'BehaviorController@getAllBehavior');
    $api->group(['middleware' => ['chxq_sign']], function ($api) {
        //查询帖子内容详情
        $api->get('post/info', 'PostController@find');
    });
    //登录
    $api->group(['middleware' => ['chxq_jwt_auth']], function ($api) {
        //获取热门分类下音乐列表
        $api->get('musicList', 'MusicListController@index');
        //音乐分类列表
        $api->get('category/list', 'MusicListController@categoryList');
        //获取某分类下所有音乐
        $api->get('music', 'MusicListController@postMusicList');

        //用户上传音乐
        $api->post('music/upload', 'MusicListController@addMusic');

    });

    //内容列表
    $api->get('post', 'PostController@index');
    //视频列表
    $api->get('post/video', 'PostController@video');
    //推荐内容
    $api->get('post/suggest', 'PostController@suggestPost');
    //内容详情
    $api->get('post/detail', 'PostController@detail');
    //话题内容列表
    $api->get('post/topic', 'PostController@topicPost');
    //话题详情
    $api->get('topic/detail', 'PostController@topicDetail');
    //评价列表
    $api->get('post/comment', 'PostController@commentList');
    //回复列表
    $api->get('post/reply', 'PostController@replyList');
    //获取内容视频组
    $api->get('post/video/group', 'PostController@getPostVideo');
    //获取话题
    $api->get('topic/group', 'PostController@getTopic');

    //图片验证
    $api->get('post/checkImage', 'PostController@checkImage');

    //登录+验签
    $api->group(['middleware' => ['chxq_jwt_auth','chxq_sign']], function ($api) {
        //发布内容
        $api->post('post', 'PostController@create');
        //删除内容
        $api->delete('post', 'PostController@delete');
        //个人中心内容
        $api->get('post/my', 'PostController@myPost');
        //评价&回复
        $api->post('post/comment', 'PostController@comment');
        //评价&回复删除
        $api->delete('post/comment', 'PostController@commentDelete');
        //话题分类
        $api->get('topicCategory', 'CategoryController@index');
        //获取话题
        $api->get('topicCategory/getTopics', 'CategoryController@getTopics');
        //话题列表
        $api->get('topic', 'PostController@topicList');
        //关注推荐话题
        $api->post('memberFollowTopic', 'MemberFollowTopic@memberFollowTopic');
        //关注单个话题
        $api->post('memberFollowTopic/follow', 'MemberFollowTopic@followTopic');
        //取消关注
        $api->delete('memberFollowTopic/cancel', 'MemberFollowTopic@cancelFollowTopic');
        //获取用户关注话题
        $api->get('memberFollowTopic/getMemberTopic', 'MemberFollowTopic@getMemberTopics');
        //关注话题列表
        $api->get('memberFollowTopic', 'MemberFollowTopic@index');
        //收藏列表
        $api->get('postCollect', 'PostCollectController@index');
        //用户发布数,收藏数,转发数
        $api->get('post/memberPostStatistics', 'PostController@memberPostStatistics');
        //关注feed流
        $api->get('feed', 'FeedController@index');

        //优秀居民信息获取
        $api->get('excellentResidents', 'BeanDetailController@excellentResidents');
        //排行榜
        $api->get('rankingList', 'BeanDetailController@rankingList');
        //后院首页
        $api->get('starHome', 'BeanDetailController@starHome');
    });


    //分享/邀请首页
    $api->get('starDetail', 'BeanDetailController@starDetail');
    //不登录单独返回每日新闻、小贴士
    $api->get('/starHome/lists', 'BeanDetailController@lists');
});