From c450c4afc53782e7f08ab2772a0167e649abd305 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Wed, 17 Jun 2020 14:29:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=95=8F=E6=84=9F=E8=AF=8D?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/system/controller/SensitiveWord.php | 67 +++++++++++++++++++ .../20200617060757_sensitive_word.php | 39 +++++++++++ catch/system/model/SensitiveWord.php | 28 ++++++++ catch/system/route.php | 3 + 4 files changed, 137 insertions(+) create mode 100644 catch/system/controller/SensitiveWord.php create mode 100644 catch/system/database/migrations/20200617060757_sensitive_word.php create mode 100644 catch/system/model/SensitiveWord.php diff --git a/catch/system/controller/SensitiveWord.php b/catch/system/controller/SensitiveWord.php new file mode 100644 index 0000000..c62d522 --- /dev/null +++ b/catch/system/controller/SensitiveWord.php @@ -0,0 +1,67 @@ +sensitiveWord = $model; + } + + /** + * 列表 + * + * @time 2020年06月17日 + * @return \think\response\Json + */ + public function index() + { + return CatchResponse::paginate($this->sensitiveWord->getList()); + } + + /** + * 保存 + * + * @time 2020年06月17日 + * @param CatchRequest $request + * @return \think\response\Json + */ + public function save(CatchRequest $request) + { + return CatchResponse::success($this->sensitiveWord->storeBy($request->param())); + } + + /** + * 更新 + * + * @time 2020年06月17日 + * @param $id + * @param CatchRequest $request + * @return \think\response\Json + */ + public function update($id, CatchRequest $request) + { + return CatchResponse::success($this->sensitiveWord->updateBy($id, $request->param())); + + } + + /** + * 删除 + * + * @time 2020年06月17日 + * @param $id + * @return \think\response\Json + */ + public function delete($id) + { + return CatchResponse::success($this->sensitiveWord->deleteBy($id)); + } + +} diff --git a/catch/system/database/migrations/20200617060757_sensitive_word.php b/catch/system/database/migrations/20200617060757_sensitive_word.php new file mode 100644 index 0000000..b4a04d7 --- /dev/null +++ b/catch/system/database/migrations/20200617060757_sensitive_word.php @@ -0,0 +1,39 @@ +table('sensitive_word',['engine'=>'InnoDB', 'comment' => '敏感词库', 'signed' => false]); + $table->addColumn('word', 'string',['limit' => 50,'default'=>'','comment'=>'词汇']) + ->addColumn('creator_id', 'integer', array('default'=>0, 'comment'=>'创建人ID', 'signed' => false )) + ->addColumn('created_at', 'integer', array('default'=>0, 'comment'=>'创建时间', 'signed' => false )) + ->addColumn('updated_at', 'integer', array('default'=>0, 'comment'=>'更新时间', 'signed' => false )) + ->addColumn('deleted_at', 'integer', array('default'=>0, 'comment'=>'删除时间', 'signed' => false )) + ->create(); + } +} diff --git a/catch/system/model/SensitiveWord.php b/catch/system/model/SensitiveWord.php new file mode 100644 index 0000000..3855895 --- /dev/null +++ b/catch/system/model/SensitiveWord.php @@ -0,0 +1,28 @@ +resource('config', '\catchAdmin\system\controller\Config'); // 代码生成 $router->post('generate', '\catchAdmin\system\controller\Generate@save'); $router->post('generate/preview', '\catchAdmin\system\controller\Generate@preview'); // 预览 + +// 敏感词 +$router->resource('sensitive/word', '\catchAdmin\system\controller\SensitiveWord'); \ No newline at end of file