service == '') { $this->service = new NewsService(); } return $this->service; } /** * Function Description:获取新闻列表 * Function Name: actionNewsList * * @return string * * @author 娄梦宁 */ public function actionNewsList(){ $param=[ 'news_title'=>$this->_post('news_title_search',''), 'current_page' => $this->_post('current_page', 1), 'page_size' => $this->_post('page_size', 10) ]; $result=$this->service()->getNewsList($param); return json_encode($result); } /** * Function Description:删除新闻 * Function Name: actionDesNews * * @return string * * @author 娄梦宁 */ public function actionDelNews() { $news_id=$this->_post('news_id',''); $result=$this->service()->DelNews($news_id); return json_encode($result); } /** * Function Description:新闻修改时获取数据 * Function Name: actionGetNewsInfo * * @return string * * @author 娄梦宁 */ public function actionGetNewsInfo() { $news_id=$this->_post('news_id',''); $result=$this->service()->GetNewsInfo($news_id); return json_encode($result); } /** * Function Description:添加或保存新闻 * Function Name: actionSaveNews * * @return string * * @author 娄梦宁 */ public function actionSaveNews() { $params = [ 'id' => $this->_post('news_id', ''), 'class_id' => $this->_post('class_id', ''), 'content' => $this->_post('content', ''), 'navi_content' => $this->_post('navi_content', ''), 'news_title' => $this->_post('news_title', ''), ]; $result=$this->service()->SaveNews($params); return json_encode($result); } }