<?php namespace controllers; use Engine\X; use Engine\Gvar; use Engine\Route; /** * 首页 */ Route::get('index', function () { $get = X::request()->get(['p' => 1]); list($count, $log) = X::module('post')->allByBanLog(Gvar::audit('company_id'), $get->p); X::render('audit/post', ['log' => $log, '__page_html' => defaultPageHtml($count, $get->p, '?')]); });
<?php namespace controllers; use Engine\X; use Engine\Gvar; use Engine\Route; /** * 添加脏词 */ Route::get('add', function () { X::render('audit/dirtyword_add'); }); Route::post('add', function () { $post = X::request()->post(['dirtyword' => '']); //添加脏词 X::module('dirtyword')->add(['words' => $post->dirtyword, 'company_id' => Gvar::audit('company_id')]); X::redirect("/audit/dirtyword/add"); }); Route::get('delete', function () { $get = X::request()->get(['id' => '']); //添加脏词 X::module('dirtyword')->del($get->id); echo "success"; });
namespace controllers; use Engine\X; use Engine\Route; use Engine\Request; /** * 内容检测api * *$post['if_spam'] = 0; //是否拦截水贴 *$post['if_duplicate_deny'] = 0; //重复内容超过次数禁IP *$post['if_spate_deny'] = 0; //短时间内大量发帖 * */ Route::post('testing', function () { $post = X::request()->post(['title' => '', 'content' => '', 'access_token' => '', 'client_ip' => '', 'if_spam' => 0, 'if_duplicate_deny' => 0, 'if_spate_deny' => 0, 'test' => 0]); if (!$post->access_token || !$post->content) { apiOutput(NO, "incomplete request"); } if (!($company = X::module('company')->exists($post->access_token))) { apiOutput(NO, "company does not exist"); } //临时关闭 if ($company['closed']) { apiOutput(NO, "service temporarily unavailable"); } //统计请求量 X::module('company')->statisticsRequest($company['company_id']); $now = time(); require 'function/post.php'; list($tutu, $process_time) = searchEngine(['content' => $post->title . $post->content, 'if_spam' => $post->if_spam], true);
/** * 查找 */ Route::get('search', function () { $get = X::request()->get(['search' => '']); $dw = X::module('dirtyword')->search($get->search); X::render('audit/index', ['dirtyword' => $dw]); }); /** * 登录 */ Route::get('signin', function () { X::render('audit/login'); }); Route::post('signin', function () { $post = X::request()->post(['account' => '', 'password' => '']); if (!$post->account || !$post->password) { X::redirect('/audit/signin'); } if ($company = X::module('company')->signin($post->account, $post->password)) { X::redirect('/audit'); } else { X::redirect('www.baidu.com'); } }); /** * 脏词管理 */ Route::get('dirtyword', function () { X::render('audit/dirtyword'); });