GetNewsList($param); return Util::returnArrSu('新闻列表获取成功!',$result); } /** * Function Description:删除新闻 * Function Name: DelNews * @param $news_id * * @return array * * @author 娄梦宁 */ public function DelNews($news_id) { if(!is_numeric ($news_id)){ return Util::returnArrEr('参数错误!'); } $zz_news=new ZzNews(); $zz_news->DelNews($news_id); return Util::returnArrSu('新闻删除成功!'); } /** * Function Description:获取新闻数据 * Function Name: GetNewsInfo * @param $news_id * * @return array * * @author 娄梦宁 */ public function GetNewsInfo($news_id) { if(!is_numeric ($news_id)){ return Util::returnArrEr('参数错误!'); } $zz_news=new ZzNews(); $data=$zz_news->GetNewsInfo($news_id); return Util::returnArrSu('新闻信息获取成功!',['news_data'=>$data]); } /** * Function Description:添加或修改新闻 * Function Name: SaveNews * @param $params * * @return array * * @author 娄梦宁 */ public function SaveNews($params) { if($params['id']=='' || $params['news_title']=='' || $params['navi_content']=='' || $params['content']=='' ||$params['class_id']=='') { return Util::returnArrEr('参数错误!'); } $zz_news=new ZzNews(); if($params['id']== -1) { $cookies = Yii::$app->request->cookies; //新增新闻 $params['user_id']=$cookies->getValue('uid',-1); $params['create_time']=date('Y-m-d H:i:s'); unset($params['id']); } $zz_news->SaveNews($params); return Util::returnArrSu('新闻保存成功!'); } }