Quellcode durchsuchen

update index module

superbee vor 7 Jahren
Ursprung
Commit
b42fc2f999
2 geänderte Dateien mit 17 neuen und 2 gelöschten Zeilen
  1. 13 0
      application/newhome/controller/Index.php
  2. 4 2
      application/user/model/UserComment.php

+ 13 - 0
application/newhome/controller/Index.php

@@ -40,4 +40,17 @@ class Index extends Controller {
 		return json(['l'=>$res]);
 	}
 	
+	public function loadFile(){
+		$data = decode($this->request->post());
+		$filename = $data['f'];
+		
+		$path = "gameconfig/$filename.txt";
+		if(!is_file($path)) return json(['error'=>1016]);
+		$file = fopen($path, "r") or die(json(['error'=>1009]));
+		$info = fread($file, filesize($path));
+		fclose($file);
+		
+		return json(['l'=>$info]);
+	}
+	
 }

+ 4 - 2
application/user/model/UserComment.php

@@ -26,9 +26,11 @@ class UserComment extends Model{
 	public function getInfoByComment($user, $comment, $type, $page = 0){
 		return $this->db()
 		->alias("c")
-		->field("c.comment_id s, c.inputtime t, c.content c, u.nickname n")
+		->field("c.comment_id s, c.inputtime t, c.user_id u,c.content c, u.nickname n")
 		->join("gd_user u", "u.id = c.comment_id", "LEFT")
-		->where(['c.user_id'=>$user, "c.comment_id"=>$comment, "c.type"=>$type])
+		->where(['c.user_id'=>[['eq', $user], ['eq', $comment], 'or']])
+		->where(['c.comment_id'=>[['eq', $user], ['eq', $comment], 'or']])
+		->where(["c.type"=>$type])
 		->page($page, config('paginate.list_rows'))
 		->order("inputtime DESC")
 		->select();