rabin 5 years ago
parent
commit
8f8c0babed
3 changed files with 33 additions and 6 deletions
  1. 4 0
      journal/database/info.php
  2. 17 3
      main/src/Journal.php
  3. 12 3
      main/src/Journal_v1.php

+ 4 - 0
journal/database/info.php

@@ -687,6 +687,7 @@ $config = array
 				//'audit' => 2,
 				'buy' => 'yes',
 				'cate_id' => 'yes',
+				'publish' => array('yes', 'like'),
 				'status' => 2,
 				'state' => 1,
 			),
@@ -704,6 +705,7 @@ $config = array
 				//'audit' => 2,
 				'cate_id_1' => array('yes-cate_id', '=', 'and('),
 				'time' => array('yes-pdate', '<=', 'or)'),
+				'publish' => array('yes', 'like'),
 				'buy' => 'yes',
 				'cate_id' => 'yes',
 				'status' => 2,
@@ -762,6 +764,7 @@ $config = array
             'option' => array
             (
                 'id' => 'yes',
+                'publish' => array('yes', 'like'),
                 'state' => 1,
             ),
             'type' => 'one',
@@ -776,6 +779,7 @@ $config = array
             	'cate_id_1' => array('yes-cate_id', '=', 'and('),
 				'time' => array('yes-pdate', '<=', 'or)'),
 				'cate_id' => 'yes',
+				'publish' => array('yes', 'like'),
             	'status' => 2,
                 'state' => 1,
             ),

+ 17 - 3
main/src/Journal.php

@@ -40,6 +40,13 @@ class Journal extends Core
             # 隐藏支付的小刊
             //$where['buy'] = 2;
         }
+
+        if ($this->app) {
+            $where['publish'] = 2;
+        } else {
+            $where['publish'] = 1;
+        }
+        
         $data = Dever::db('journal/info')->getAll($where);
         if ($data) {
             foreach ($data as $k => $v) {
@@ -74,19 +81,26 @@ class Journal extends Core
         if (isset($cate['id'])) {
             $where['cate_id'] = $cate['id'];
         }
+        $where['publish'] = 1;
         if ($this->app) {
             $where['cate_id_1'] = 1;
             $where['time'] = $time - $day;
+            $where['publish'] = 2;
 
             # 获取最新的小刊
             $this->data['push'] = Dever::db('journal/info')->getNew($where);
 
         } else {
+            $this->data['push'] = array();
             if (isset($cate['journal_id'])) {
-                $this->data['push'] = Dever::db('journal/info')->getOne($cate['journal_id']);
-            } else {
+                $push_where['id'] = $cate['journal_id'];
+                $push_where['publish'] = $where['publish'];
+                $this->data['push'] = Dever::db('journal/info')->getOne($push_where);
+            }
+            if (!$this->data['push']) {
                 # 获取最新的小刊
-                $this->data['push'] = Dever::db('journal/info')->getNew();
+                $new_where['publish'] = $where['publish'];
+                $this->data['push'] = Dever::db('journal/info')->getNew($new_where);
             }
         }
         

+ 12 - 3
main/src/Journal_v1.php

@@ -39,11 +39,19 @@ class Journal_v1 extends Core
         if (isset($cate['id'])) {
             $where['cate_id'] = $cate['id'];
         }
+        $where['publish'] = 1;
+
+        $this->data['push'] = array();
         if (isset($cate['journal_id'])) {
-            $this->data['push'] = Dever::db('journal/info')->getOne($cate['journal_id']);
-        } else {
+            $push_where['id'] = $cate['journal_id'];
+            $push_where['publish'] = $where['publish'];
+            $this->data['push'] = Dever::db('journal/info')->getOne($push_where);
+        }
+
+        if (!$this->data['push']) {
             # 获取最新的小刊
-            $this->data['push'] = Dever::db('journal/info')->getNew();
+            $new_where['publish'] = $where['publish'];
+            $this->data['push'] = Dever::db('journal/info')->getNew($new_where);
         }
 
         $this->data['push'] = $this->info($this->data['push']);
@@ -123,6 +131,7 @@ class Journal_v1 extends Core
 
         $where['cate_id_1'] = 1;
         $where['time'] = $time - $day;
+        $where['publish'] = 2;
 
         # 获取最新的小刊
         $this->data['push'] = Dever::db('journal/info')->getNew($where);