Пример #1
0
 /**
  * 修改新闻状态
  *
  *
  */
 public function statusAction()
 {
     $id = $this->getg('id', 0);
     if (empty($id)) {
         $this->error('id 不能为空!');
     }
     $status = $this->getg('status', 0);
     $status = $status ? 0 : 1;
     // 实例化Model
     $news = new NewsModel();
     $row = $news->update(array('id' => $id), array('status' => $status));
     if ($row) {
         $this->error('恭喜,操作成功', 'Message');
     } else {
         $this->error('操作失败');
     }
 }