|
@@ -42,14 +42,14 @@ class User extends Controller {
|
|
|
public function other(){
|
|
|
$data = decode($this->request->post());
|
|
|
|
|
|
- $info = $this->userModel->getUserById($data['u']);
|
|
|
+ $res = $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]);
|
|
|
+ return json(['l'=>$info, 'p'=>$res['praise']]);
|
|
|
}
|
|
|
|
|
|
public function load(){
|
|
@@ -57,11 +57,13 @@ class User extends Controller {
|
|
|
$id = $data['u'];
|
|
|
$path = "load/$id.txt";
|
|
|
|
|
|
+ $res = $this->userModel->getUserByCode($id);
|
|
|
+
|
|
|
$file = fopen($path, "r") or die(json(['error'=>1009]));
|
|
|
$info = fread($file, filesize($path));
|
|
|
fclose($file);
|
|
|
|
|
|
- return json(['l'=>$info]);
|
|
|
+ return json(['l'=>$info, 'p'=>$res['praise']]);
|
|
|
}
|
|
|
|
|
|
public function save(){
|
|
@@ -80,13 +82,14 @@ class User extends Controller {
|
|
|
$data = decode($this->request->post());
|
|
|
|
|
|
$short = $this->userModel->randOtherCode($data['i']);
|
|
|
+ $res = $this->userModel->getUserByCode($short);
|
|
|
|
|
|
$path = "load/$short.txt";
|
|
|
$file = fopen($path, "r") or die(json(['error'=>1009]));
|
|
|
$info = fread($file, filesize($path));
|
|
|
fclose($file);
|
|
|
|
|
|
- return json(['l'=>$info]);
|
|
|
+ return json(['l'=>$info, 'p'=>$res['praise']]);
|
|
|
}
|
|
|
|
|
|
public function delete(){
|
|
@@ -100,4 +103,10 @@ class User extends Controller {
|
|
|
return json(['r'=>(($res)?1:0)]);
|
|
|
}
|
|
|
|
|
|
+ public function look(){
|
|
|
+ $res = $this->userModel->lookList();
|
|
|
+
|
|
|
+ return json(['l'=>$res]);
|
|
|
+ }
|
|
|
+
|
|
|
}
|