mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 08:22:17 +00:00
http response returns the timestamp of the change
This commit is contained in:
@@ -80,9 +80,22 @@ class Profil extends Auth_Controller
|
||||
|
||||
if (empty($res)) {
|
||||
$insert_res = $this->ProfilChangeModel->insert($data);
|
||||
echo json_encode($insert_res);
|
||||
if(isError($insert_res)){
|
||||
//catch error
|
||||
}else{
|
||||
//? status code 201 CREATED
|
||||
$insert_res->code = 201;
|
||||
$insert_res->retval = $this->ProfilChangeModel->getTimestamp($this->uid)->change_timestamp;
|
||||
echo json_encode($insert_res);
|
||||
}
|
||||
|
||||
} else {
|
||||
$update_res = $this->ProfilChangeModel->update([$this->uid], $data);
|
||||
if(isError($update_res)){
|
||||
//catch error
|
||||
}
|
||||
//? status code 200 OK
|
||||
$update_res->code = 200;
|
||||
echo json_encode($update_res);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,20 +19,10 @@ class Profil_change_model extends DB_Model
|
||||
/**
|
||||
* getLastStatuses
|
||||
*/
|
||||
public function getData($uid){
|
||||
|
||||
$res = $this->load($uid);
|
||||
$res = hasData($res) ? getData($res)[0] : null;
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function insertData($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
//$res = hasData($res) ? getData($res)[0] : null;
|
||||
|
||||
return $res;
|
||||
}
|
||||
public function getTimestamp($uid){
|
||||
$this->addSelect(['change_timestamp']);
|
||||
$res = $this->load([$uid]);
|
||||
return hasData($res) ? getData($res)[0] : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user