Added call merge

This commit is contained in:
dev-chiefworks
2022-04-02 21:17:26 -04:00
parent bb1eebb80c
commit 251a27d75c
2 changed files with 40 additions and 5 deletions
+20 -1
View File
@@ -6,6 +6,25 @@ class Home extends BaseController
{ {
public function index() public function index()
{ {
return view('welcome_message'); $endpoints = array(
'getdrycleanservicelist' => array('POST'),
'createuser' => array('POST'),
'userlogin' => array('POST'),
'updateprofile' => array('POST'),
'updsprofile' => array('POST'),
'newlundrypickup' => array('POST'),
'newdrycleanpickup' => array('POST'),
'confirmlundrypickup' => array('POST'),
'savecardpayment' => array('POST'),
'getlundrylocation' => array('POST'),
'getcardpaymentlist' => array('POST'),
'getmyservicelist' => array('POST'),
'getoneserviceitem' => array('POST'),
'loadprofile' => array('POST'),
'deletecard' => array('POST')
);
$data['endpoints'] = $endpoints;
return view('welcome_message',$data);
} }
} }
+20 -4
View File
@@ -17,19 +17,23 @@ class Savvy extends BaseController
public function index() public function index()
{ {
echo "Savvy......."; // echo "Savvy.......";
log_message('critical', "API-WAS CALLED" );
} }
public function user(){ public function user(){
log_message('critical', "API-WAS CALLED user" );
header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Origin: *");
//header("x-devicetoken : *");
//header("Authorization : Token");
header("Access-Control-Expose-Headers: 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, client_id"); header("Access-Control-Allow-Headers: Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With,x-session-id, client_id, x-float-device-location-latitude, x-float-device-location-longitude, x-devicetoken");
header("Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS"); header("Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS");
header('Content-type: application/json'); header('Content-type: application/json');
// $res = FloatLogin::floatLoginUser(); // $res = FloatLogin::floatLoginUser();
//Access-Control-Allow-Origin
if ( "OPTIONS" === $_SERVER['REQUEST_METHOD'] ) { if ( "OPTIONS" === $_SERVER['REQUEST_METHOD'] ) {
exit(); exit();
@@ -105,6 +109,10 @@ class Savvy extends BaseController
$res=[]; $res=[];
log_message('critical', "API-WAS CALLED user 009" );
// log_message('critical', json_encode($in) );
// log_message('critical', json_encode($_POST) );
switch ($endpoint) { switch ($endpoint) {
case 'getdrycleanservicelist': $in["action"] = SAVVYEXT_USER_DRYCLIST; case 'getdrycleanservicelist': $in["action"] = SAVVYEXT_USER_DRYCLIST;
@@ -122,7 +130,14 @@ class Savvy extends BaseController
$data = json_decode($res, TRUE); $data = json_decode($res, TRUE);
if (isset($data['accessToken'])){ if (isset($data['accessToken'])){
$res = UserProfile::floatUserProfile($data['accessToken']); $res = UserProfile::floatUserProfile($data['accessToken']);
//log_message('info', 'User {id} logged into the system from {ip_address}', json_decode($ $resProfile, TRUE));
// log_message('info', $resProfile );
// $data = json_decode($resProfile, TRUE);
// $data = $resProfile; //json_decode($ $resProfile, TRUE);
// $res = $data; // array_merge($data, ['accessToken'=>$data['accessToken']] );
// $res['accessToken'] = $data['accessToken'];
} }
} }
@@ -165,6 +180,7 @@ class Savvy extends BaseController
case 'deletecard': $in["action"] = SAVVYEXT_USER_DELETECARD; case 'deletecard': $in["action"] = SAVVYEXT_USER_DELETECARD;
break; break;
} }
//echo $res;
echo json_encode($res); echo json_encode($res);
exit(); exit();