dever %!s(int64=6) %!d(string=hai) anos
pai
achega
84bebf894c
Modificáronse 2 ficheiros con 23 adicións e 5 borrados
  1. 13 4
      act/lib/Subscribe.php
  2. 10 1
      main/src/Journal.php

+ 13 - 4
act/lib/Subscribe.php

@@ -36,10 +36,19 @@ class Subscribe
     # 获取小刊订阅列表
     public function getList($id, $type = 4)
     {
-        $where['type'] = $type;
-        $where['data_id'] = $id;
-        $where['avatar'] = 'null';
-        $data = Dever::db('act/subscribe')->getAll($where);
+        $key = 'subscribe_' . $type . '_' . $id;
+        $data = Dever::cache($key);
+        if (!$data) {
+            $where['type'] = $type;
+            $where['data_id'] = $id;
+            $where['avatar'] = 'null';
+            $data = Dever::db('act/subscribe')->getAll($where);
+
+            if ($data) {
+                Dever::cache($key, $data, 900);
+            }
+        }
+        
 
         /*
         if ($data) {

+ 10 - 1
main/src/Journal.php

@@ -126,7 +126,16 @@ class Journal extends Core
         $where['type'] = 4;
         $where['source'] = '1,2';
         $where['cate_id'] = $cate['id'];
-        $data = Dever::db('act/subscribe')->getMyAll($where);
+
+        $key = 'my_subscribe_' . $where['uid'] . '_' . $cate['id'];
+        $data = Dever::cache($key);
+        if (!$data) {
+            $data = Dever::db('act/subscribe')->getMyAll($where);
+            if ($data) {
+                Dever::cache($key, $data, 900);
+            }
+        }
+        
         if ($data) {
             foreach ($data as $k => $v) {
                 $data[$k] = $this->info($v);