rabin 5 years ago
parent
commit
ba54754fab
2 changed files with 44 additions and 19 deletions
  1. 22 0
      journal/database/info.php
  2. 22 19
      main/src/Journal_v1.php

+ 22 - 0
journal/database/info.php

@@ -771,6 +771,28 @@ $config = array
             'col' => $col,
         ),
 
+        # 热门
+        'getHot' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				//'audit' => 2,
+				'hot' => 1,
+				'buy' => 'yes',
+				'time' => array('yes-pdate', '<=', 'or)'),
+				'publish' => array('yes', 'like'),
+				'buy_type' => 'yes',
+				'cate_id' => 'yes',
+				'status' => 2,
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			//'page' => array(10, 'list'),
+			'col' => $col,
+		),
+
         'getNew' => array
         (
             # 匹配的正则或函数 选填项

+ 22 - 19
main/src/Journal_v1.php

@@ -40,25 +40,18 @@ class Journal_v1 extends Core
             $where['cate_id'] = $cate['id'];
         }
         $where['publish'] = 1;
+        $this->data['button'] = array();
 
-        $this->data['push'] = array();
-        if (isset($cate['journal_id'])) {
-            $push_where['id'] = $cate['journal_id'];
-            $push_where['publish'] = $where['publish'];
-            $this->data['push'] = Dever::db('journal/info')->getOne($push_where);
-        }
+        # 热门电子刊
+        $this->data['push'] = Dever::db('journal/info')->getHot($where);
 
-        if (!$this->data['push']) {
-            # 获取最新的小刊
-            $new_where['publish'] = $where['publish'];
-            $this->data['push'] = Dever::db('journal/info')->getNew($new_where);
+        if ($this->data['push']) {
+            foreach ($this->data['push'] as $k => $v) {
+                $this->data['push'][$k] = $this->info($v);
+                $this->data['push'][$k] = $this->getButton($this->data['push'][$k]);
+            }
         }
 
-        $this->data['push'] = $this->info($this->data['push']);
-        $this->data['button'] = array();
-        $this->data['push'] = $this->getButton($this->data['push']);
-
-        
         $data = Dever::db('journal/info')->getAllByPage($where);
 
         if ($data) {
@@ -134,13 +127,23 @@ class Journal_v1 extends Core
         $where['publish'] = 2;
 
         # 获取最新的小刊
-        $this->data['push'] = Dever::db('journal/info')->getNew($where);
+        //$this->data['push'] = Dever::db('journal/info')->getNew($where);
 
-        $this->data['push'] = $this->ding($this->data['push']);
+        //$this->data['push'] = $this->ding($this->data['push']);
 
         $this->data['button'] = array();
-        //$this->data['push'] = $this->getButton($this->data['push']);
-        //$this->data['push'] = $this->getAppSet($this->data['push']);
+        ////$this->data['push'] = $this->getButton($this->data['push']);
+        ////$this->data['push'] = $this->getAppSet($this->data['push']);
+
+        # 热门电子刊
+        $this->data['push'] = Dever::db('journal/info')->getHot($where);
+
+        if ($this->data['push']) {
+            foreach ($this->data['push'] as $k => $v) {
+                $this->data['push'][$k] = $this->info($v);
+                $this->data['push'][$k] = $this->getButton($this->data['push'][$k]);
+            }
+        }
 
         
         $data = Dever::db('journal/info')->getAllByPage($where);