<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| 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!
|
*/

$routes=array(
    'getCurrentGame'=> exeApi('api','PrizeHandle','getNewprizeGamedata'),
    'setCurrentGameStatus' => exeApi( 'api', 'PrizeHandle',  'updateCloses'),
    'setCheckGame'=> exeApi('api','PrizeHandle','UpdateCheckgame'),
    'getjnd28Info'=> exeApi('api','PrizeHandle','Getjnd28Info'),
    'checkJnd28'=>exeApi('api','PrizeHandle', 'checkJnd28'),
    'delGamebetInfo'=> exeApi('api','PrizeHandle','DelinfoBytime'),
    'getOpeninfo' => exeApi( 'api', 'Basicinfo',  'getOnOrOff'),
    'clearTable' => exeApi( 'api', 'Basicinfo',  'clearTable'),    //清空指定表数据
    'addRecharge' => exeApi( 'api', 'Recharges',  'AddRecharge'),
    'odds' => exeApi('api', 'BetLog', 'odds'),
    'rechargeMoney'=> exeApi('admin','Regulation','AddOrCutMoney'),
    'countHistory' => exeApi('api', 'History', 'index'),
    'HistoryCount'=>exeApi('api', 'History', 'count'),
    'getBetLog'=> exeApi('api', 'BetLog', 'getBetLog'),
    'updateBnumber'=>exeApi('admin', 'bnumber','update'),
    'batchUpdateBnumber' => exeApi('admin', 'bnumber', 'batchUpdate'),
    'autoOpenPrize'=>exeApi('api', 'OpenPrize','open'),
    'nagentCountwater'=>exeApi('api', 'PrizeHandle','CountWater'),  //级差代理业绩统计
    'kygame'=>exeApi('api', 'Kygame','getPipelineRecord'),
    'oggame'=>exeApi('api', 'Oggame','getPipelineRecord'),
    'aggameDownloadFile'=>exeApi('api', 'Aggame','downloadFile'),
    'aggameReadFile'=>exeApi('api', 'Aggame','readerFile'),
    'a'=>exeApi('api', 'Aggame','aftp'),
    'lcqpgame'=>exeApi('api', 'Lcqpgame','getPipelineRecord'),
    'lygame'=>exeApi('api', 'Lygame','getPipelineRecord'),
    'hjgame'=>exeApi('api', 'HjGame','getPipelineRecord'),
    'ogsports'=>exeApi('api', 'Oggame_sport','getPipelineRecord'),
    'fygame'=>exeApi('api', 'fyGame','getBetting'),
    'setSports'=>exeApi('api', 'WriteSports','setSports'),
    'upMatch'=>exeApi('api', 'WriteSports','upMatch'),
);










































function exeApi($m, $c, $act)
{
    return array('m' => $m, 'c' => $c, 'act' => $act);
}
Route::any('/{name}', function ($name) use($routes) {
    if(!isset($routes[$name])){
        return responseToJson(-404,'404');
    }
    $target=$routes[$name];
    return appExec($target['m'], $target['c'], $target['act']);
})->middleware('api');
