diff --git a/catch/system/controller/Developer.php b/catch/system/controller/Developer.php new file mode 100644 index 0000000..17b5246 --- /dev/null +++ b/catch/system/controller/Developer.php @@ -0,0 +1,89 @@ +model = $model; + } + + /** + * 列表 + * + * @time 2020/07/13 15:26 + * + * @return \think\Response + */ + public function index() + { + return CatchResponse::paginate($this->model->getList()); + } + + /** + * 保存 + * + * @time 2020/07/13 15:26 + * @param Request Request + * @return \think\Response + */ + public function save(Request $request) + { + return CatchResponse::success($this->model->storeBy($request->post())); + } + + /** + * 读取 + * + * @time 2020/07/13 15:26 + * @param $id + * @return \think\Response + */ + public function read($id) + { + return CatchResponse::success($this->model->findBy($id)); + } + + /** + * 更新 + * + * @time 2020/07/13 15:26 + * @param Request $request + * @return \think\Response + */ + public function update(Request $request, $id) + { + return CatchResponse::success($this->model->updateBy($id, $request->post())); + } + + /** + * 删除 + * + * @time 2020/07/13 15:26 + * @param $id + * @return \think\Response + */ + public function delete($id) + { + return CatchResponse::success($this->model->deleteBy($id)); + } + + +} \ No newline at end of file diff --git a/catch/system/database/migrations/20200713152608_developers.php b/catch/system/database/migrations/20200713152608_developers.php new file mode 100644 index 0000000..446fe80 --- /dev/null +++ b/catch/system/database/migrations/20200713152608_developers.php @@ -0,0 +1,44 @@ +table('developers', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '开发者' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]); + $table->addColumn('username', 'string', ['limit' => 50,'null' => false,'default' => '','signed' => false,'comment' => '用户名',]) + ->addColumn('password', 'string', ['limit' => 255,'null' => false,'default' => '','signed' => false,'comment' => '密码',]) + ->addColumn('mobile', 'string', ['limit' => 30,'null' => false,'default' => '','signed' => false,'comment' => '手机号',]) + ->addColumn('id_card', 'string', ['limit' => 50,'null' => false,'default' => '','signed' => false,'comment' => '身份证',]) + ->addColumn('alipay_account', 'string', ['limit' => 100,'null' => false,'default' => '','signed' => false,'comment' => '支付宝账户',]) + ->addColumn('status', 'boolean', ['null' => false,'default' => 1,'signed' => false,'comment' => '1 待认证 1 已认证',]) + ->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '创建时间',]) + ->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '更新时间',]) + ->addColumn('deleted_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '软删除',]) + ->create(); + } +} diff --git a/catch/system/model/Developers.php b/catch/system/model/Developers.php new file mode 100644 index 0000000..899b850 --- /dev/null +++ b/catch/system/model/Developers.php @@ -0,0 +1,34 @@ +group(function () use ($router){ // 敏感词 $router->resource('sensitive/word', '\catchAdmin\system\controller\SensitiveWord'); -})->middleware('auth'); \ No newline at end of file +})->middleware('auth'); + +//developer路由 +$router->resource('developer', '\catchAdmin\system\controller\Developer')->middleware('auth'); \ No newline at end of file