From 2e53366717ad57da1a9dd6dc71a69c078961ad74 Mon Sep 17 00:00:00 2001
From: colly_wyx <wangyixiong_007@163.com>
Date: Thu, 10 Aug 2017 17:21:37 +0800
Subject: [PATCH] 新闻模块,平台首页
---
application/modules/Admin/controllers/Index.php | 40 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 39 insertions(+), 1 deletions(-)
diff --git a/application/modules/Admin/controllers/Index.php b/application/modules/Admin/controllers/Index.php
index 3db73bc..0354726 100644
--- a/application/modules/Admin/controllers/Index.php
+++ b/application/modules/Admin/controllers/Index.php
@@ -9,7 +9,45 @@
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���= $this->get('id');
+ if(!empty($id)){
+ $article = $this->article_service->getArticleInfo(array('_id' => $id));
+ if($article){
+ $this->getView()->assign('article', $article);
+ }
+ else{
+ $this->redirect('/error/show/type/no_data');
+ }
+ }
+ else{
+ $this->redirect('/error/show/type/not_found');
+ }
+ }
+
}
--
Gitblit v1.8.0