dever 6 年之前
父节点
当前提交
2f2124d9ea
共有 1 个文件被更改,包括 15 次插入7 次删除
  1. 15 7
      act/lib/Invite.php

+ 15 - 7
act/lib/Invite.php

@@ -9,14 +9,22 @@ class Invite
     # 获取小刊的邀请排行
     # 获取小刊的邀请排行
     public function getList($uid, $id, $type = 4, $num = false)
     public function getList($uid, $id, $type = 4, $num = false)
     {
     {
-        $where['source_uid'] = $uid;
-        $where['type'] = $type;
-        $where['data_id'] = $id;
-        if ($num > 0) {
-            $where['page'] = array(6, 'list');
+        $key = 'invite_' . $uid . '_' . $type . '_' . $id;
+        $data = Dever::cache($key);
+        if (!$data) {
+        	$where['source_uid'] = $uid;
+            $where['type'] = $type;
+            $where['data_id'] = $id;
+            if ($num > 0) {
+                $where['page'] = array(6, 'list');
+            }
+            $where['avatar'] = 'null';
+            $data = Dever::db('act/invite')->getAll($where);
+
+            if ($data) {
+                Dever::cache($key, $data, 900);
+            }
         }
         }
-        $where['avatar'] = 'null';
-        $data = Dever::db('act/invite')->getAll($where);
 
 
         /*
         /*
         if ($data) {
         if ($data) {