|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | class IndexController extends System_Controller_Admin | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public function init(){ | 
|---|
|  |  |  | parent::init(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public function indexAction() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | $this->_view->word= '123'; | 
|---|
|  |  |  | $daily_service = new Service_Daily(); | 
|---|
|  |  |  | $article_service = new Service_Article(); | 
|---|
|  |  |  | $user_id = $this->session['user']['user_id']; | 
|---|
|  |  |  | $start_time = strtotime("-7 day"); | 
|---|
|  |  |  | $end_time = strtotime("-1 day"); | 
|---|
|  |  |  | $diff_days = ($end_time - $start_time) / 86400; | 
|---|
|  |  |  | $total_days = $diff_days + 1;//时间段内总天数 | 
|---|
|  |  |  | //$step = ($total_days - $total_days % 7) / 7; | 
|---|
|  |  |  | $days_arr=  array(); | 
|---|
|  |  |  | for($i = 0; $i < $total_days ; $i++){ | 
|---|
|  |  |  | $days_arr[] = date('Y-m-d', strtotime('+'.$i.' day', $start_time)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | $user_dailys = $daily_service->getUserDataList($user_id, $days_arr); | 
|---|
|  |  |  | $system_news = $article_service->getArticleList(array('category' => '1'), array(), array('create_time' => -1), 5); | 
|---|
|  |  |  | $industry_news = $article_service->getArticleList(array('category' => '2'), array(), array('create_time' => -1), 5); | 
|---|
|  |  |  | $ffs_news = $article_service->getArticleList(array('category' => '3'), array(), array('create_time' => -1), 5); | 
|---|
|  |  |  | $my_news = $article_service->getArticleList(array('category' => '4'), array(), array('create_time' => -1), 5); | 
|---|
|  |  |  | $this->getView()->assign(array('user_dailys' => $user_dailys, 'days_arr' => $days_arr, 'system_news' => $system_news, 'industry_news' => $industry_news, 'ffs_news' => $ffs_news, 'my_news' => $my_news)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查看新闻 | 
|---|
|  |  |  | * @param [type] $id [description] | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public function LookAction($id){ | 
|---|
|  |  |  | $article_service = new Service_Article(); | 
|---|
|  |  |  | $article = $article_service->getArticleInfo(array('_id' => $id)); | 
|---|
|  |  |  | if($article){ | 
|---|
|  |  |  | $this->getView()->assign('article', $article); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else{ | 
|---|
|  |  |  | $this->redirect('/error/show/type/no_data'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|