Backend Service

This commit is contained in:
2019-03-17 21:05:52 +00:00
parent aea9090510
commit be67ec3729
5 changed files with 100 additions and 11 deletions
+36 -9
View File
@@ -20,17 +20,18 @@ header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$endpoints = array(
'createuser' => array('POST'),
'login' => array('POST'),
'userlogin' => array('POST'),
'getprofile' => array('POST'),
'createuser' => array('POST'),
'login' => array('POST'),
'userlogin' => array('POST'),
'getprofile' => array('POST'),
'setprofile' => array('POST'),
'userstask' => array('POST'),
'createtask' => array('POST'),
'deletetask' => array('POST')
'deletetask' => array('POST'),
'getpractice' => array('POST')
);
/*
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Origin: *");
header("Access-Control-Expose-Headers: Access-Control-Allow-Origin");
header("Access-Control-Allow-Headers: Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
header("Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS");
@@ -101,7 +102,12 @@ switch ($endpoint) {
case 'deletetask':
$in["action"] = MERMS_USER_REMINDERS;
$in["task_mode"] = USER_DELETETASK;
break;
break;
case 'getpractice':
$in["action"] = MERMS_USER_PRACTICES;
$in["task_mode"] = MODE_GETVALUE;
break;
}
@@ -177,8 +183,29 @@ function processOutJson($in, $out) {
switch ($in["action"]) {
case 1000:
case MERMS_USER_PRACTICES:
if ( $in["task_mode"] == MODE_GETVALUE )
{
$total = $out["total_record"];
$res = array(
"status" => $out["status"],
"total_record" => ($total),
"internal_return" => $out["internal_return"],
"result_list" => array(),
);
for ($i = 0; $i < $total; $i++) {
$key = sprintf("%05d", $i);
$res["result_list"][] = array(
"id" => $out["id_${key}"],
"patient_id" => $out["patient_id_${key}"],
"name" => $out["name_${key}"],
"long_id" => $out["long_id_${key}"],
"patient_added" => $out["patient_added_${key}"],
"patient_status" => $out["patient_status_${key}"]
);
} // "request_id"
}
break;
case MERMS_USER_REMINDERS: