<?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.
|
*/

$router->get('/', ['as' => 'index', 'uses' => 'WebController@index']);
$router->get('/app', ['as' => 'app', 'uses' => 'AppController@index']);
$router->get('/frontend', ['as' => 'frontend', 'uses' => 'WebController@frontend']);
$router->get('/code',['as' => 'code','uses' => 'AppController@getUserInfo']);
$router->get('/pk/room/{id}', ['as' => 'pk_room', 'uses' => 'WebController@room']);
$router->get('/corp/activity',['as' => 'corp_activity', 'uses' => 'CorpController@activityList']);
$router->get('/my/join',['as' => 'my_join', 'uses' => 'CorpController@joinActivity']);
$router->get('/dingtalk/person/activity',['as' => 'dingtalk_person_activity', 'uses' => 'PersonDingtalkController@activityList']);
$router->get('/dingtaok/person/my/join',['as' => 'dingtalk_person_my_join', 'uses' => 'PersonDingtalkController@joinActivity']);
$router->get('/dingtalk',['as' => 'dingtalk_activity_url', 'uses' => 'DingtalkController@index']);

//前端接口
$router->group(["prefix" => 'api'], function () use ($router) {
    $router->get('/user/info', ['as' => 'userInfo', 'uses' => 'ApiGuestController@userInfo']);
    $router->get('/base/info', ['as' => 'baseInfo', 'uses' => 'ApiGuestController@baseInfo']);
    $router->get('/base/class', ['as' => 'class', 'uses' => 'ApiGuestController@getClass']);
    $router->get('/other/activitys', ['as' => 'other_activity', 'uses' => 'ApiGuestController@otherActivitys']);
    $router->get('/pk/room/info',['as' => 'roomInfo', 'uses' => 'ApiGuestController@room']);
    $router->post('/sms/verifycode/send', ['as' => 'sendSms', 'uses' => 'ApiGuestController@sendsms']);
    $router->post('/user/bind', ['as' => 'userBind', 'uses' => 'ApiGuestController@userbind']);
    $router->get('/user/info/{id}', ['as' => 'userInfoById', 'uses' => 'ExampleController@user']);
    $router->get('/top/department/join/rate', ['as' => 'joinRate', 'uses' => 'ApiTopController@joinRate']);
    $router->get('/top/department/km/avg', ['as' => 'kmavg', 'uses' => 'ApiTopController@departmentKmAvg']);
    $router->get('/top/person/all', ['as' => 'personAll', 'uses' => 'ApiTopController@personKm']);
    $router->get('/top/person/department', ['as' => 'personDepartment', 'uses' => 'ApiTopController@personDepartmentKm']);
    $router->get('/mark', ['as' => 'mark', 'uses' => 'ApiTopController@mark']);
    $router->get('/lottery', ['as' => 'lottery', 'uses' => 'ApiController@lotteryResult']);                             // 获取本人抽奖的结果
    $router->get('/lottery/{id}', ['as' => 'lottery', 'uses' => 'ApiController@lottery']);                              // 抽奖接口
    $router->get('/pk/online/users', ['as' => 'pk_online_users', 'uses' => 'PkApiController@getOnlineUsers']);          //获取在线用户列表
    $router->get('/pk/top', ['as' => 'pk_top', 'uses' => 'PkApiController@getTop']);                                    //获取排行榜信息及当前用户信息
    $router->post('/pk/challenge', ['as' => 'pk_challenge', 'uses' => 'PkApiController@postChallenge']);                //发起PK
    $router->post('/pk/response', ['as' => 'pk_response', 'uses' => 'PkApiController@postPkResponse']);                 //PK应答
});

//后台接口
$router->group(['prefix' => 'console'], function () use ($router) {
    $router->get('/cache/question', ['as' => 'cache_question', 'uses' => 'Console\CacheController@question']);          //生成题目缓存
    $router->get('/cache/config', ['as' => 'cache_config', 'uses' => 'Console\CacheController@config']);                //生成配置缓存
    $router->get('/pk/process', ['as' => 'pk_process', 'uses' => 'Console\PkProcessController@getResultProcess']);      //PK结果处理接口
});


/**
 * 项目链接
 */

$router->group(['prefix' => 'p'], function () use ($router) {
    $router->get('/2018/kingdee', ['as' => '2018_kingdee', 'uses' => 'CaseController@e18Kingdee']);      //金蝶项目链接
    $router->get('/2018/essence', ['as' => '2018_essence', 'uses' => 'CaseController@e18Essence']);      //安信项目链接
});

$router->get('/test', ['as' => 'test', 'uses' => 'ExampleController@test']);
$router->get('/base', ['as' => 'baseIndex', 'uses' => 'ExampleController@baseIndex']);

/*$router->group(["prefix" => 'example'], function () use ($router) {
    $router->get('/cache', ['as' => 'index', 'uses' => 'ExampleController@cache']);
    $router->get('/test', ['as' => 'test', 'uses' => 'ExampleController@test']);
    $router->get('/sso', ['as' => 'test', 'uses' => 'ExampleController@sso']);
    $router->get('/login', ['as' => 'login', 'uses' => 'ExampleController@login']);
    $router->get('/pk', ['as' => 'pk', 'uses' => 'ExampleController@pk']);
});*/
