<?php

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
$api = app('Dingo\Api\Routing\Router');

$api->version('v1', [
    'namespace' => 'App\Http\Controllers\Api',
    'middleware' => ['serializer:array','cors','activity_log','bindings']
], function ($api) {

    $api->group([
        'middleware' => 'api.throttle',
        'limit' => config('api.rate_limits.access.limit'),
        'expires' => config('api.rate_limits.access.expires')
    ], function ($api) {
        /*
        |--------------------------------------------------------------
        |  首页内容
        |--------------------------------------------------------------
        */
        $api->group(['prefix' => 'home'], function ($api) {
            $api->post('/home', 'HomeController@home')->name('home.home');
            $api->post('/get_location', 'HomeController@get_location')->name('home.get_location');
            $api->post('/get_fx', 'HomeController@get_fx')->name('home.get_fx');
            $api->post('/user_detail', 'HomeController@user_detail')->name('home.user_detail');
            $api->post('/user_dynamic', 'HomeController@user_dynamic')->name('home.user_dynamic');
            $api->post('/photo_destroy', 'HomeController@photo_destroy')->name('home.photo_destroy');
        });

        /*
        |--------------------------------------------------------------
        |  动态相关
        |--------------------------------------------------------------
        */
        $api->group(['prefix' => 'dynamic'], function ($api) {
            $api->post('/get_tag_list', 'DynamicController@get_tag_list')->name('dynamic.get_tag_list');
            $api->post('/get_list', 'DynamicController@get_list')->name('dynamic.get_list');
            $api->get('/dynamic_info', 'DynamicController@dynamic_info')->name('dynamic.dynamic_info');
        });



        /*
        |--------------------------------------------------------------
        |  登录相关
        |--------------------------------------------------------------
        */
        $api->group(['prefix' => 'login'], function ($api) {
            $api->post('/login_by_mobile', 'AuthorizationsController@login_by_mobile')->name('login.mobile');
            $api->post('/login_by_password', 'AuthorizationsController@login_by_account_password')->name('login.password');
            $api->post('/forget_password', 'AuthorizationsController@forget_password')->name('login.forget');
            $api->post('/register', 'AuthorizationsController@register')->name('login.register');
            $api->get('/xieyi', 'AuthorizationsController@xieyi')->name('login.xieyi');
            $api->get('/captcha', 'AuthorizationsController@captcha')->name('login.captcha');
            $api->post('/reg_h5', 'AuthorizationsController@reg_h5')->name('login.reg_h5');
            $api->post('/auth_login', 'AuthorizationsController@auth_login')->name('login.auth_login');
        });

        /*
        |--------------------------------------------------------------
        |  获取oss上传配置
        |--------------------------------------------------------------
        */
        $api->group(['prefix' => 'upload-config'], function ($api) {
            $api->get('/config', 'UploadConfigController@config')->name('upload.config');
        });

        /*
        |--------------------------------------------------------------
        |  发送短信验证码
        |--------------------------------------------------------------
        */
        $api->group(['prefix' => 'sms'], function ($api) {
            $api->get('/send', 'SmsController@send')->name('sms.send');
        });



    });
    //需要 token 验证的接口
    $api->group(['middleware' => 'api.auth',
        'limit' => config('api.rate_limits.access.limit'),
        'expires' => config('api.rate_limits.access.expires')], function ($api) {
        /*
        |--------------------------------------------------------------
        |  用户信息相关
        |--------------------------------------------------------------
        */
        $api->group(['prefix' => 'user'], function ($api) {
            //设置性别
            $api->post('/checksex', 'UserController@checksex')->name('user.checksex');
            //设置资料（初次注册进入时）
            $api->post('/setinfo', 'UserController@setinfo')->name('user.setinfo');
            $api->post('/setpass', 'UserController@setpass')->name('user.setpass');
            $api->get('/getinfo', 'UserController@getinfo')->name('user.getinfo');
            $api->get('/get_photo', 'UserController@get_photo')->name('user.get_photo');
            $api->post('/upload_file', 'UserController@upload_file')->name('user.upload_file');
            $api->post('/updateinfo', 'UserController@updateinfo')->name('user.updateinfo');
            $api->post('/problem', 'UserController@problem')->name('user.problem');
            $api->post('/looked_me', 'UserController@looked_me')->name('user.looked_me');
            $api->get('/get_vip', 'UserController@get_vip')->name('user.get_vip');
            $api->post('/buy_vip', 'UserController@buy_vip')->name('user.buy_vip');
            $api->post('/check_auth', 'UserController@check_auth')->name('user.check_auth');
            $api->post('/black_list', 'UserController@black_list')->name('user.black_list');
            $api->post('/del_black', 'UserController@del_black')->name('user.del_black');
            $api->post('/online_status', 'UserController@online_status')->name('user.online_status');
            $api->get('/get_vip_info', 'UserController@get_vip_info')->name('user.get_vip_info');
            $api->get('/invite_info', 'UserController@invite_info')->name('user.invite_info');
            $api->post('/get_invite_list', 'UserController@get_invite_list')->name('user.get_invite_list');
            $api->get('/receive_day', 'UserController@receive_day')->name('user.receive_day');
            $api->post('/del_file', 'UserController@del_file')->name('user.del_file');
            $api->post('/auth_center', 'UserController@auth_center')->name('user.auth_center');
            $api->get('/distory_user', 'UserController@distory_user')->name('user.distory_user');
            $api->get('/share', 'UserController@share')->name('user.share');
            $api->get('/getinfo_tag', 'UserController@getinfo_tag')->name('user.getinfo_tag');
            $api->post('/reset_password', 'UserController@reset_password')->name('user.reset_password');

        });

        /*
        |--------------------------------------------------------------
        |  动态相关
        |--------------------------------------------------------------
        */
        $api->group(['prefix' => 'dynamic'], function ($api) {
            $api->post('/release', 'DynamicController@release')->name('dynamic.release');
            $api->post('/del_tag', 'DynamicController@del_tag')->name('dynamic.del_tag');
            $api->post('/my_list', 'DynamicController@my_list')->name('dynamic.my_list');
            $api->post('/zan', 'DynamicController@zan')->name('dynamic.zan');
            $api->post('/del', 'DynamicController@del')->name('dynamic.del');
            $api->post('/report', 'DynamicController@report')->name('dynamic.report');
        });

        /*
        |--------------------------------------------------------------
        |  首页内容
        |--------------------------------------------------------------
        */
        $api->group(['prefix' => 'home'], function ($api) {
            $api->post('/do_like', 'HomeController@do_like')->name('home.do_like');
            $api->post('/do_comment', 'HomeController@do_comment')->name('home.do_comment');
            $api->post('/get_weixin', 'HomeController@get_weixin')->name('home.get_weixin');
            $api->post('/lahei', 'HomeController@lahei')->name('home.lahei');

        });

        /*
        |--------------------------------------------------------------
        |  消息相关
        |--------------------------------------------------------------
        */
        $api->group(['prefix' => 'notice'], function ($api) {
            $api->post('/get_notice_list', 'NoticeController@get_notice_list')->name('notice.get_notice_list');
            $api->post('/get_like_list', 'NoticeController@get_like_list')->name('notice.get_like_list');
            $api->post('/get_zan_list', 'NoticeController@get_zan_list')->name('notice.get_zan_list');
            $api->post('/get_system_message', 'NoticeController@get_system_message')->name('notice.get_system_message');
            $api->post('/del_system_message', 'NoticeController@del_system_message')->name('notice.del_system_message');
        });

        /*
        |--------------------------------------------------------------
        |  聊天相关
        |--------------------------------------------------------------
        */
        $api->group(['prefix' => 'chat'], function ($api) {
            $api->post('/add_friend', 'ChatController@add_friend')->name('chat.add_friend');
            $api->post('/get_friend', 'ChatController@get_friend')->name('chat.get_friend');
        });


        /*
        |--------------------------------------------------------------
        |  文件上传
        |--------------------------------------------------------------
        */
        $api->post('/upload', 'UploadController@upload')->name('upload');

        /*
        |--------------------------------------------------------------
        |  退出登录
        |--------------------------------------------------------------
        */
        $api->put('/logout', 'AuthorizationsController@logout')->name('logout');
    });

    /*
    |--------------------------------------------------------------
    |  支付回调
    |--------------------------------------------------------------
    */
    $api->any('/wx_notify', 'PayNotifyController@wx_notify')->name('wx_notify');
    $api->any('/ali_notify', 'PayNotifyController@ali_notify')->name('ali_notify');
    $api->any('/creat_user', 'TestController@creat_user')->name('creat_user');
    $api->any('/create_dynamic', 'TestController@create_dynamic')->name('create_dynamic');
    $api->any('/test_push', 'TestController@test_push')->name('test_push');
    $api->any('/jg_auth', 'TestController@jg_auth')->name('jg_auth');
    $api->any('/tencent_notify', 'TencentController@notify')->name('notify');


});
