diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 7f867e9..b7f0942 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -6,6 +6,25 @@ class Home extends BaseController { 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); } } diff --git a/app/Controllers/Savvy.php b/app/Controllers/Savvy.php index 1a393ff..67570e7 100644 --- a/app/Controllers/Savvy.php +++ b/app/Controllers/Savvy.php @@ -17,19 +17,23 @@ class Savvy extends BaseController public function index() { - echo "Savvy......."; + // echo "Savvy......."; + log_message('critical', "API-WAS CALLED" ); } public function user(){ - + log_message('critical', "API-WAS CALLED user" ); header("Access-Control-Allow-Origin: *"); + //header("x-devicetoken : *"); + //header("Authorization : Token"); 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('Content-type: application/json'); // $res = FloatLogin::floatLoginUser(); +//Access-Control-Allow-Origin if ( "OPTIONS" === $_SERVER['REQUEST_METHOD'] ) { exit(); @@ -105,6 +109,10 @@ class Savvy extends BaseController $res=[]; + log_message('critical', "API-WAS CALLED user 009" ); + + // log_message('critical', json_encode($in) ); + // log_message('critical', json_encode($_POST) ); switch ($endpoint) { case 'getdrycleanservicelist': $in["action"] = SAVVYEXT_USER_DRYCLIST; @@ -122,7 +130,14 @@ class Savvy extends BaseController $data = json_decode($res, TRUE); 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; break; } +//echo $res; echo json_encode($res); exit();