superbee vor 8 Jahren
Ursprung
Commit
2273f11ca7

+ 1 - 1
application/home/controller/Comment.php

@@ -33,7 +33,7 @@ class Comment extends Controller {
 		$user = $data['u'];
 		$comment = $data['c'];
 		$content = $data['i'];
-		$type = $data['t'];
+		$type = $data['t'];		
 		
 		$data = ['id'=>getId(), 'user_id'=>$user, 'comment_id'=>$comment, 'content'=>$content, 'type'=>$type];
 		$this->commentModel->add($data);

+ 11 - 0
application/home/controller/Praise.php

@@ -27,4 +27,15 @@ class Praise extends Controller{
 		return json(['error'=>0]);
 	}
 	
+	public function target(){
+		$data = decode($this->request->post());
+		
+		$user = $data['u'];
+		$target = $data['t'];
+		
+		$info = $this->praiseModel->getTargetInfo($user, $target);
+		
+		return json(['i'=>($info)?1:0]);
+	}
+	
 }

+ 13 - 0
application/home/controller/User.php

@@ -39,6 +39,19 @@ class User extends Controller {
 		return json($info);
 	}
 	
+	public function other(){
+		$data = decode($this->request->post());
+		
+		$info = $this->userModel->getUserById($data['u']);
+		$path = "load/".$info['short'].'.txt';
+		
+		$file = fopen($path, "r") or die(json(['error'=>1009]));
+		$info = fread($file, filesize($path));
+		fclose($file);
+		
+		return json(['l'=>$info]);
+	}
+	
 	public function load(){
 		$data = decode($this->request->post());
 		$id = $data['u'];

+ 2 - 1
application/user/model/User.php

@@ -84,11 +84,12 @@ class User extends Model{
 	 */
 	public function loginByUid($uid){
 		$this->data['uid'] = $uid;
-		$info = $this->db()->field('id i, diamond d, coin c, short o')->where(array("uid"=>$uid))->find();
+		$info = $this->db()->field('id i, diamond d, coin c, short o, praise p')->where(array("uid"=>$uid))->find();
 		
 		if(empty($info)) {
     		$info['d'] = 0;
     		$info['c'] = 0;
+    		$info['p'] = 0;
     		$info['i'] = $this->createUser($uid);
     		$info['o'] = $this->data['short'];
     	}

+ 3 - 5
application/user/model/UserComment.php

@@ -13,11 +13,9 @@ class UserComment extends Model{
 	}
 	
 	public function getInfo($user, $type, $page = 0){
-		$this->db()
-		->alias("c")
-		->field("u.short s, c.inputtime t, c.content c")
-		->where(['c.user_id'=>$user, "c.type"=>$type])
-		->join("gd_user u", "c.comment_id = u.id", "left")
+		return $this->db()
+		->field("comment_id s, inputtime t, content c")
+		->where(['user_id'=>$user, "type"=>$type])
 		->page($page, config('paginate.list_rows'))
 		->order("inputtime DESC")
 		->select();