dever 4 years ago
parent
commit
793f3507d9
3 changed files with 12 additions and 9 deletions
  1. 1 0
      app/collection/lib/Core.php
  2. 1 1
      app/collection/lib/Info.php
  3. 10 8
      app/user/lib/Info.php

+ 1 - 0
app/collection/lib/Core.php

@@ -132,6 +132,7 @@ class Core
             $this->index = $code[4] ? $code[4] : 0;
             $this->times = $code[5];
             if (isset($code[6]) && $code[6]) {
+                # 用户设置时间
                 $this->day = $code[6];
             } else {
                 $this->day = 0;

+ 1 - 1
app/collection/lib/Info.php

@@ -7,7 +7,7 @@ use Dever;
 class Info
 {
 	# 获取内容
-    protected function get($id)
+    public function get($id)
     {
         $info = Dever::db('collection/info')->one($id);
         

+ 10 - 8
app/user/lib/Info.php

@@ -51,15 +51,17 @@ class Info
 	# 获取用户信息
 	public function get($user, $id, $author = false)
 	{
+        if (is_array($user)) {
+            $uid = $user['id'];
+        } else {
+            $uid = $user;
+        }
+        $key = 'user_' . $uid . '_' . $id . '_' . $author;
+        if (isset($this->user[$key])) {
+            return $this->user[$key];
+        }
 		if (is_numeric($user)) {
-			if (isset($this->user[$user])) {
-				return $this->user[$user];
-			}
 			$user = Dever::load('passport/api')->info($user);
-		} else {
-			if (isset($this->user[$user['id']])) {
-				return $this->user[$user['id']];
-			}
 		}
 		$result = array();
 		if ($user) {
@@ -96,7 +98,7 @@ class Info
                 $result['author'] = $collection['author_name'];
             }
         }
-		$this->user[$user['id']] = $result;
+		$this->user[$key] = $result;
 		
 		return $result;
 	}