dever 6 years ago
parent
commit
636a8cc7a6
2 changed files with 21 additions and 11 deletions
  1. 3 0
      journal/database/info.php
  2. 18 11
      main/src/Journal.php

+ 3 - 0
journal/database/info.php

@@ -613,6 +613,9 @@ $config = array
             # 匹配的正则或函数 选填项
             'option' => array
             (
+            	'cate_id_1' => array('yes-cate_id', '=', 'and('),
+				'time' => array('yes-pdate', '<=', 'or)'),
+				'cate_id' => 'yes',
             	'status' => 2,
                 'state' => 1,
             ),

+ 18 - 11
main/src/Journal.php

@@ -58,27 +58,34 @@ class Journal extends Core
     {
         $cate = $this->getCate();
 
-        if (isset($cate['journal_id'])) {
-            $this->data['push'] = Dever::db('journal/info')->getOne($cate['journal_id']);
-        } else {
-            # 获取最新的小刊
-            $this->data['push'] = Dever::db('journal/info')->getNew(array('time' => time()));
-        }
-        
-
-        $this->data['push'] = $this->ding($this->data['push']);
+        $time = time();
+        $day = (7 * 86400);
 
         # 小刊列表
         $where = array();
         if (isset($cate['id'])) {
             $where['cate_id'] = $cate['id'];
         }
-
         if ($this->app) {
             $where['cate_id_1'] = 1;
-            $where['time'] = time() - (7 * 86400);
+            $where['time'] = $time - $day;
+
+            # 获取最新的小刊
+            $this->data['push'] = Dever::db('journal/info')->getNew($where);
+
+        } else {
+            if (isset($cate['journal_id'])) {
+                $this->data['push'] = Dever::db('journal/info')->getOne($cate['journal_id']);
+            } else {
+                # 获取最新的小刊
+                $this->data['push'] = Dever::db('journal/info')->getNew();
+            }
         }
         
+
+        $this->data['push'] = $this->ding($this->data['push']);
+
+        
         $data = Dever::db('journal/info')->getAllByPage($where);
 
         if ($data) {