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