title = '文章管理'; $query = $this->_query($this->table)->like('title')->equal('is_show'); $query->where('is_del',1)->order('id desc')->page(); } /** * 添加 * @auth true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function add() { $this->create_at = date('Y-m-d H:i:s'); $this->_form($this->table, 'form'); } /** * 编辑 * @auth true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function edit() { $this->_form($this->table, 'form'); } /** * 禁用 * @auth true * @throws \think\Exception * @throws \think\exception\PDOException */ public function forbid() { $this->_save($this->table, ['is_show' => '0']); } /** * 启用 * @auth true * @throws \think\Exception * @throws \think\exception\PDOException */ public function resume() { $this->_save($this->table, ['is_show' => '1']); } /** * 删除 * @auth true * @throws \think\Exception * @throws \think\exception\PDOException */ public function del() { $this->_save($this->table, ['is_del' => '0']); } }