public function del() { $id = I('id', NULL); if (!empty($id)) { if (is_array($id)) { $where = 'id in (' . implode(',', $id) . ')'; } else { $where = 'id = ' . $id; } $article = new ArticleModel(); if (false !== $article->where($where)->delete()) { $this->message('删除成功', __URL__ . '/index'); } else { $this->message('删除失败:' . $article->getError(), __URL__ . '/index'); } } else { $this->message('请选择删除对象', __URL__ . '/index'); } }
/** * 文章编辑更新页面 */ function update() { $article = new ArticleModel(); if (!!($data = $article->create())) { if (!empty($data['id'])) { if (false !== $article->save()) { $this->assign('jumpUrl', __URL__ . '/index'); $this->success('更新成功'); } else { $this->error('更新失败:' . $article->getDbError()); } } else { $this->error('请选择编辑用户'); } } else { $this->error('更新失败:( ' . $article->getError() . ' )'); } }