getList($this->postData()); return $this->renderSuccess('', compact('list')); } /** * 添加 */ public function add() { $model = new SchoolModel; // 新增记录 if ($model->add($this->postData())) { return $this->renderSuccess('添加成功'); } return $this->renderError($model->getError() ?: '添加失败'); } /** * 编辑 */ public function edit($school_id) { // 详情 $model = SchoolModel::detail($school_id); // 更新记录 if ($model->edit($this->postData())) { return $this->renderSuccess('更新成功'); } return $this->renderError($model->getError() ?: '更新失败'); } /** * 删除 */ public function delete($school_id) { $model = SchoolModel::detail($school_id); if (!$model->remove()) { return $this->renderError('删除失败'); } return $this->renderSuccess('删除成功'); } }