<?php /** * Created by PhpStorm. * User: meathill * Date: 14/11/12 * Time: 下午5:24 */ use NoahBuscher\Macaw\Macaw; Macaw::get(BASE . '', 'diy\\controller\\HomeController@home'); Macaw::get(BASE . 'dashboard/', 'diy\\controller\\HomeController@dashboard'); Macaw::options(BASE . 'file/', 'diy\\controller\\BaseController@on_options'); Macaw::post(BASE . 'file/', 'diy\\controller\\FileController@upload'); Macaw::options(BASE . 'fetch/', 'diy\\controller\\BaseController@on_options'); Macaw::post(BASE . 'fetch/', 'diy\\controller\\FileController@fetch'); Macaw::error(function () { echo '404 :: Not Found'; });
<?php use NoahBuscher\Macaw\Macaw; Macaw::get('/', function () { echo 'Hello world!'; }); Macaw::post('/', function () { echo 'I <3 POST commands!'; }); Macaw::error(function () { echo '404 :: Not Found'; }); Macaw::get('/test', 'TestController@index'); Macaw::dispatch();
<?php /** * Created by PhpStorm. * User: meathill * Date: 14/11/16 * Time: 下午3:29 */ use NoahBuscher\Macaw\Macaw; Macaw::get(BASE . 'stat/', 'diy\\controller\\StatController@get_ad_stat'); Macaw::get(BASE . 'stat/(:any)', 'diy\\controller\\StatController@get_the_ad_stat'); Macaw::get(BASE . 'stat/(:any)/(:any)', 'diy\\controller\\StatController@get_ad_daily_stat'); Macaw::get(BASE . 'stat/analyse/', 'diy\\controller\\StatController@get_daily_stat'); Macaw::get(BASE . 'stat/analyse/daily/(:any)', 'diy\\controller\\StatController@get_daily_ad'); Macaw::get(BASE . 'stat/export_payment/', 'diy\\controller\\StatController@export_payment'); Macaw::options(BASE . 'invoice/', 'diy\\controller\\BaseController@on_options'); Macaw::get(BASE . 'invoice/', 'diy\\controller\\InvoiceController@get_list'); Macaw::options(BASE . 'invoice/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::post(BASE . 'invoice/(:any)', 'diy\\controller\\InvoiceController@create'); Macaw::get(BASE . 'invoice/(:any)', 'diy\\controller\\InvoiceController@init'); Macaw::patch(BASE . 'invoice/(:any)', 'diy\\controller\\InvoiceController@update'); Macaw::delete(BASE . 'invoice/(:any)', 'diy\\controller\\InvoiceController@delete'); Macaw::options(BASE . 'invoice/ad/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::patch(BASE . 'invoice/ad/(:any)', 'diy\\controller\\InvoiceController@update_invoice_ad'); Macaw::get(BASE . 'invoice/settle/(:any)', 'diy\\controller\\InvoiceController@get_transfer_ad'); Macaw::get(BASE . 'adStat/(:any)/', 'diy\\controller\\ADStatController@get_stat'); Macaw::get(BASE . 'adStat/(:any)/comment/', 'diy\\controller\\ADStatController@get_stat_comments'); Macaw::get(BASE . 'adStat/(:any)/date/(:any)', 'diy\\controller\\ADStatController@get_stat_by_date'); Macaw::get(BASE . 'adStat/(:any)/apk/(:any)', 'diy\\controller\\ADStatController@get_stat_by_apk'); Macaw::get(BASE . 'adStat/(:any)/loc/(:any)', 'diy\\controller\\ADStatController@get_stat_by_loc'); Macaw::get(BASE . 'adStat/(:any)/hour/(:any)', 'diy\\controller\\ADStatController@get_stat_by_hour');
<?php /** * Created by PhpStorm. * User: meathill * Date: 14/11/15 * Time: 下午6:02 */ use NoahBuscher\Macaw\Macaw; Macaw::get(BASE . 'ad/', 'diy\\controller\\ADController@get_list'); Macaw::get(BASE . 'ad/(:any)', 'diy\\controller\\ADController@init'); Macaw::get(BASE . 'ad_basic/', 'diy\\controller\\ADController@get_list_basic'); Macaw::options(BASE . 'ad/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::post(BASE . 'ad/(:any)', 'diy\\controller\\ADController@create'); Macaw::patch(BASE . 'ad/(:any)', 'diy\\controller\\ADController@update'); Macaw::delete(BASE . 'ad/(:any)', 'diy\\controller\\ADController@delete'); Macaw::get(BASE . 'ad/(:any)/upload/', 'diy\\controller\\ADController@get_upload_history'); Macaw::get(BASE . 'apply/', 'diy\\controller\\ApplyController@get_list'); Macaw::options(BASE . 'apply/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::patch(BASE . 'apply/(:any)', 'diy\\controller\\ApplyController@update'); Macaw::delete(BASE . 'apply/(:any)', 'diy\\controller\\ApplyController@delete'); Macaw::get(BASE . 'info/', 'diy\\controller\\HistoryInfo@get_list'); Macaw::post(BASE . 'baobei/(:any)', 'diy\\controller\\ADController@resend_baobei_email'); Macaw::get(BASE . 'data-load/(:any)', 'diy\\controller\\ADController@data_load'); Macaw::get(BASE . 'competitor_ad/', 'diy\\controller\\CompetitorAdController@get'); Macaw::options(BASE . 'competitor_ad/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::patch(BASE . 'competitor_ad/(:any)', 'diy\\controller\\CompetitorAdController@update');
}); //分类链接 Macaw::get('/category/(:num).html', function ($slug) { $home = new HomeController(); $home->category($slug); }); //ajax刷新 Macaw::get('/home/getdata/', function () { $home = new HomeController(); $home->getAjaxData(); }); //文章链接 Macaw::get('/article/(:num).html', function ($slug) { $home = new HomeController(); $home->artice($slug); }); //登录 Macaw::get('/admin/login/', 'LoginController@login'); Macaw::post('/admin/login/', 'LoginController@login'); //验证码 Macaw::get('/admin/code', 'LoginController@code'); //退出登录 Macaw::get('/admin/logout/', 'LoginController@logout'); Macaw::$error_callback = function () { throw new Exception("路由无匹配项 404 Not Found"); }; Macaw::get('/admin/test/page/(:num)/key/(:any)', function ($num, $param) { $mytestController = new MytestController(); $mytestController->home($num, $param); }); Macaw::dispatch();
<?php /** * 处理用户相关的请求 * Created by PhpStorm. * User: meathill * Date: 14/11/13 * Time: 下午3:04 */ use NoahBuscher\Macaw\Macaw; Macaw::get(BASE . 'auth/', 'diy\\controller\\UserController@get_info'); Macaw::options(BASE . 'auth/', 'diy\\controller\\BaseController@on_options'); Macaw::delete(BASE . 'auth/', 'diy\\controller\\UserController@logout'); Macaw::post(BASE . 'auth/', 'diy\\controller\\UserController@login'); Macaw::patch(BASE . 'auth/', 'diy\\controller\\UserController@update'); Macaw::get(BASE . 'auth/finance/', 'diy\\controller\\UserController@get_my_finance');
// редактирование события Macaw::post('event_actions', function () { $user = checkAuth(); if (!isset($_POST['action'])) { Application::sendJson(["err" => "UNDEFINED_ACTION"]); } $action = $_POST['action']; if (!isset($_POST['id'])) { Application::sendJson(["err" => "UNDEFINED_EVENT_ID"]); } $event = GreaseRatEvent::retrieveByPK(intval($_POST['id'])); if (!$event) { Application::sendJson(["err" => "UNDEFINED_EVENT"]); } switch ($action) { case "DELETE": $event->delete(); Application::sendJson(["err" => "OK"]); break; case "MOVE": if (!isset($_POST["data"])) { Application::sendJson(["err" => "UNDEFINED_FORM_DATA"]); } $_POST["data"]["id"] = intval($_POST['id']); Application::sendJson(processForm($_POST["data"])); break; default: Application::sendJson(["err" => "UNDEFINED_ACTION"]); break; } }); Macaw::error(function () {
/** * CFPHP - A utility and can faster php framework * * @author xiaobeicn <*****@*****.**> * * @description 路由规则 * */ use NoahBuscher\Macaw\Macaw as Route; Route::get('/', 'HomeController@hello'); /** * http://localhost/cfphp/home/demo/aaa/123/a-b-c * * public function demo($parameters){ * cf_dump($parameters); * } * * //string 'aaa,123,a-b-c' (length=13) * */ Route::get('/home/demo/(:any)/(:num)/(:all)', 'HomeController@demo'); Route::get('/home/model', 'HomeController@model'); Route::get('/home/redis', 'HomeController@redis'); Route::get('/home/upload', 'HomeController@upload'); Route::post('/home/upload', 'HomeController@upload'); Route::get('/home/mail', 'HomeController@mail'); Route::get('/home/image', 'HomeController@image'); Route::get('/home/log', 'HomeController@log'); Route::error(function () { echo '404 :: Not Found'; });
<?php /** * Created by PhpStorm. * User: meathill * Date: 15/5/19 * Time: 上午10:58 */ use NoahBuscher\Macaw\Macaw; Macaw::options(BASE . 'channel/', 'diy\\controller\\BaseController@on_options'); Macaw::post(BASE . 'channel/', 'diy\\controller\\ChannelController@create'); Macaw::get(BASE . 'channel/', 'diy\\controller\\ChannelController@get_list'); Macaw::options(BASE . 'channel/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::patch(BASE . 'channel/(:any)', 'diy\\controller\\ChannelController@update'); Macaw::delete(BASE . 'channel/(:any)', 'diy\\controller\\ChannelController@delete'); Macaw::options(BASE . 'crm/', 'diy\\controller\\BaseController@on_options'); Macaw::get(BASE . 'crm/', 'diy\\controller\\ChannelController@get_ads');