937 lines
35 KiB
PHP
937 lines
35 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
use CodeIgniter\HTTP\URI;
|
|
use App\Services\FloatLogin;
|
|
use App\Services\UserProfile;
|
|
use App\Services\ResetPassword;
|
|
use App\Services\NewUserApi;
|
|
|
|
|
|
use GuzzleHttp\Client as HTTPClient;
|
|
use Exception;
|
|
|
|
|
|
class Savvy extends BaseController
|
|
{
|
|
|
|
|
|
public function index()
|
|
{
|
|
// echo "Savvy.......";
|
|
log_message('critical', "API-WAS CALLED" );
|
|
|
|
}
|
|
private function testCards(){
|
|
$extension_call = false;
|
|
$cards = new \App\Models\userCards();
|
|
$in["member_id"] =1;
|
|
$in['card_type'] = 55000;
|
|
$in['card_count'] =20;
|
|
$out = [];
|
|
$outX = [];
|
|
|
|
$in["action"] = SAVVY_USERSAPP_SLIDECARD;
|
|
$outX["action"] = SAVVY_USERSAPP_SLIDECARD;
|
|
|
|
$cards->loadSavedCard($in, $outX);
|
|
|
|
$out = $this->processOutJson($outX, $outX);
|
|
|
|
log_message('critical', "INTO API-WAS CALLED user************************************ =>loadSavedCard" );
|
|
$this->logArray($out);
|
|
log_message('critical', "OUT API-WAS CALLED user************************************ =>loadSavedCard" );
|
|
|
|
// $cards->loadSliderCard($in, $out);
|
|
// log_message('critical', "INTO API-WAS CALLED user************************************ =>testCards" );
|
|
// $this->logArray($out);
|
|
// log_message('critical', "OUT API-WAS CALLED user************************************ =>testCards" );
|
|
}
|
|
public function user(){
|
|
// ini_set("memory_limit","1024M");
|
|
ini_set('memory_limit', '-1');
|
|
//$this-> testCards();
|
|
|
|
/*encryption:
|
|
{
|
|
algorithm = "aes-256-ctr";
|
|
key = "1234567890abcdef1234567890abcdef";
|
|
iv = "1234567890abcdef";
|
|
};
|
|
|
|
*/
|
|
$inx=[];
|
|
$encryptionAlg = "aes-256-ctr"; // $savvyext->cfgReadChar('encryption.algorithm');
|
|
$encryptionKey = "1234567890abcdef1234567890abcdef"; // $savvyext->cfgReadChar('encryption.key');
|
|
$encryptionIV = "1234567890abcdef"; // $savvyext->cfgReadChar('encryption.iv');
|
|
|
|
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,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();
|
|
}
|
|
|
|
// what is the endpoint
|
|
$uri = current_url(true);
|
|
$pieces = explode("/", $uri);
|
|
$endpoint = $pieces[6];
|
|
|
|
|
|
$endpoints = array(
|
|
'createuser' => array('POST'),
|
|
'userlogin' => array('POST'),
|
|
'tracklocation' => array('POST'),
|
|
'savecardpayment' => array('POST'),
|
|
'getcardpaymentlist' => array('POST'),
|
|
'managepaymentlist' => array('POST'),
|
|
'loadprofile' => array('POST'),
|
|
'updateprofile' => array('POST'),
|
|
'verifysession' => array('POST'),
|
|
"refreshsession" => array('POST'),
|
|
'linkemail' => array('POST'),
|
|
'listlinkedemail' => array('POST'),
|
|
'refreshlinkemail' => array('POST'),
|
|
'usertransportlist' => array('POST'),
|
|
'usertransportprofile' => array('POST'),
|
|
'getdashcarddata' => array('POST'),
|
|
'loadsavedcards' => array('POST'),
|
|
'savedashcard' => array('POST'),
|
|
'saveuserbudget' => array('POST'),
|
|
'resetpass' => array('POST'),
|
|
'settingsarray' => array('POST'),
|
|
'loadsubsription' => array('POST'),
|
|
'subscriptionstatus' => array('POST'),
|
|
'getapplist' => array('POST'),
|
|
'getslidecarddata' => array('POST'),
|
|
'subscribedcarddata' => array('POST'),
|
|
'subscribecard' => array('POST'),
|
|
"savesurvey" => array('POST'),
|
|
"pointsdetail" => array('POST'),
|
|
"loadredeemabale" => array('POST'),
|
|
"redeempoints" => array('POST'),
|
|
"managefeature" => array('POST'),
|
|
"carpool" => array('POST'),
|
|
'logout' => array('POST'),
|
|
"carpoolstatus" => array('POST'),
|
|
"getsavedtrips" => array('POST'),
|
|
"savedtrip" => array('POST'),
|
|
"removesavedtrip" => array('POST'),
|
|
"trackcardclick" => array('POST'),
|
|
"membersettings" => array('POST'),
|
|
"persnoality" => array('POST'),
|
|
);
|
|
|
|
|
|
if(array_key_exists( $endpoint, $endpoints)){
|
|
// echo "EXYTACT INPUT DATA HERE";
|
|
}
|
|
else{
|
|
http_response_code(404);
|
|
// tell the user product does not exist
|
|
echo json_encode(array("message" => "Product does not exist."));
|
|
}
|
|
|
|
|
|
if (!isset($endpoints[$endpoint])) {
|
|
header('HTTP/1.1 400 Bad Request');
|
|
header('Status: 400 Bad Request');
|
|
echo "{\"status\":\"Invalid endpoint url\"}";
|
|
exit();
|
|
}
|
|
|
|
$methods = $endpoints[$endpoint];
|
|
|
|
if (array_search($_SERVER['REQUEST_METHOD'], $methods)===false) {
|
|
header('HTTP/1.1 405 Method Not Allowed');
|
|
header('Status: 405 Method Not Allowed');
|
|
echo "{\"status\":\"Invalid request method\"}";
|
|
exit();
|
|
}
|
|
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if ($endpoint == "uploadfile") {
|
|
upload_file_call();
|
|
exit();
|
|
} else {
|
|
// $in = $this->flatten(json_decode(file_get_contents('php://input'), true));
|
|
$raw_json = file_get_contents("php://input");
|
|
$raw_array = json_decode($raw_json, true);
|
|
if ($endpoint == "createuser") {
|
|
$inx = $raw_array;
|
|
} else {
|
|
$inx = $this->flatten($raw_array);
|
|
$this->logArray($inx);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "PUT") {
|
|
parse_str(file_get_contents('php://input'), $in);
|
|
}
|
|
|
|
$in["loc"] = $_SERVER["REMOTE_ADDR"]; // get who is connecting IP
|
|
$in["pid"] = 100;
|
|
|
|
$res=[];
|
|
|
|
log_message('critical', "API-WAS CALLED user 009=>".$endpoint );
|
|
|
|
// log_message('critical', json_encode($in) );
|
|
// log_message('critical', json_encode($_POST) );
|
|
// $inx = $_POST;
|
|
$this->logArray($inx);
|
|
// Decrypt the input
|
|
if (isset($inx['encrypted_payload'])) {
|
|
log_message('critical', "API-WAS DECRYPT STARTED=>".$endpoint );
|
|
$payload = openssl_decrypt(hex2bin($inx['encrypted_payload']), $encryptionAlg, $encryptionKey, OPENSSL_RAW_DATA, $encryptionIV);
|
|
log_message('critical', "API-WAS DECRYPT END=>".$endpoint );
|
|
|
|
unset($inx['encrypted_payload']);
|
|
$inx = array_merge($in, json_decode($payload, true));
|
|
}
|
|
|
|
|
|
switch ($endpoint) {
|
|
case 'subscribedcarddata':
|
|
|
|
$in["action"] = SAVVY_USERSAPP_SLIDECARD;
|
|
$cards = new \App\Models\userCards();
|
|
$inx['card_type'] = 55000;
|
|
// $in['card_count'] =20;
|
|
$out = [];
|
|
$outX = [];
|
|
$inx["action"] = SAVVY_USERSAPP_SLIDECARD;
|
|
$outX["action"] = SAVVY_USERSAPP_SLIDECARD;
|
|
$cards->loadSliderCard($inx, $outX);
|
|
$out = $this->processOutJson($outX, $outX);
|
|
break;
|
|
|
|
case 'getsavedtrips':
|
|
$inx['action'] = SAVVY_USER_GETSAVEDTRIPS;
|
|
|
|
$this->logArray($inx);
|
|
log_message('critical', "INTO -- API-WAS CALLED ************************************ =>".$endpoint );
|
|
$trips = new \App\Models\userTrips();
|
|
$outX["action"] = $inx["action"];
|
|
$trips->savvyLoadSavedTrips($inx, $outX);
|
|
$res = $this->processOutJson($outX, $outX);
|
|
log_message('critical', "OUT API-WAS CALLED getsavedtrips************************************ =>".$endpoint );
|
|
break;
|
|
|
|
case 'refreshsession':
|
|
if (isset($inx['sessionid'])){
|
|
$inx['accessToken'] = $inx['sessionid'];
|
|
$resProfile = UserProfile::floatUserProfile($inx['accessToken']);
|
|
$this->logArray($resProfile);
|
|
$res = json_decode($resProfile, true);
|
|
$this->logArray($res);
|
|
}
|
|
break;
|
|
case 'resetpass': $in["action"] = 10011111111;
|
|
$res = ResetPassword::procResetPassword($inx);
|
|
$this->logArray($res);
|
|
break;
|
|
case 'createuser': $in["action"] = SAVVY_USER_CREATEACCOUNT;
|
|
$in["street1"] = $in["streetaddress"];
|
|
$in["zipcode"] = $in["zip"];
|
|
$in["country"] = "US";
|
|
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
|
log_message('critical', "in API-WAS CALLED user 009=>".$endpoint );
|
|
$res = NewUserApi::createAccount($data);
|
|
log_message('critical', "out API-WAS CALLED user 009=>".$endpoint );
|
|
break;
|
|
case 'userlogin': $in["action"] = SAVVY_USER_LOGINACCOUNT;
|
|
log_message('critical', "API-WAS CALLED user 10-009=>".$endpoint );
|
|
|
|
//{"username":"ses66181@gmail.com","password":"12345678","sessionid":"DUMMYSESSION","loc":"172.24.0.1","pid":100}
|
|
if ($inx['username'] == 'ses66181@gmail.com'){
|
|
// $res= $this->dummy_data();
|
|
}
|
|
else{
|
|
|
|
}
|
|
$resLogin = FloatLogin::floatLoginUser($inx['username'], $inx['password']);
|
|
log_message('critical', "Login Returned=>".$endpoint );
|
|
$this->logArray($resLogin);
|
|
$resLoginArray = json_decode($resLogin, true);
|
|
$this->logArray($resLoginArray);
|
|
log_message('critical', "Ready for Profile=>".$resLoginArray['accessToken'] );
|
|
if (!empty($resLoginArray) && is_array($resLoginArray)){
|
|
if (isset($resLoginArray['accessToken'])){
|
|
$resProfile = UserProfile::floatUserProfile($resLoginArray['accessToken']);
|
|
$this->logArray($resProfile);
|
|
$res = json_decode($resProfile, true);
|
|
$this->logArray($res);
|
|
}
|
|
}
|
|
else{
|
|
log_message('critical', "Login Failed for User=>".$inx['username'] );
|
|
$res["internal_return"] = "0";
|
|
}
|
|
break;
|
|
|
|
case 'updateprofile': $in["action"] = SAVVYEXT_USER_PROFILE;
|
|
$in["street1"] = $in["streetaddress"];
|
|
$in["zipcode"] = $in["zip"];
|
|
$in["country"] = "US";
|
|
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
|
break;
|
|
case 'updsprofile': $in["action"] = SAVVYEXT_USER_COMPLETEPROFILE;
|
|
log_message('critical', "INTO API-WAS CALLED user************************************ =>".$endpoint );
|
|
$this->logArray($inx);
|
|
log_message('critical', "INTO API-WAS CALLED user************************************ =>".$endpoint );
|
|
break;
|
|
case 'getcardpaymentlist': $in["action"] = SAVVYEXT_USER_GETCCLIST;
|
|
log_message('critical', "INTO API-WAS CALLED user************************************ =>".$endpoint );
|
|
$this->logArray($inx);
|
|
log_message('critical', "INTO API-WAS CALLED user************************************ =>".$endpoint );
|
|
break;
|
|
|
|
case 'newlundrypickup': $in["action"] = SAVVYEXT_USER_NEWLUNDRYPICK;
|
|
$in["service_type"] = 1;
|
|
$in["service_date"] = $in["pickupdate"] . " " . $in["pickuptime"];
|
|
break;
|
|
case 'newdrycleanpickup': $in["action"] = SAVVYEXT_USER_NEWLUNDRYPICK;
|
|
$in["service_type"] = 2;
|
|
$in["service_date"] = $in["pickupdate"] . " " . $in["pickuptime"];
|
|
break;
|
|
case 'confirmlundrypickup': $in["action"] = SAVVYEXT_USER_CONFIRMPICKUP;
|
|
break;
|
|
case 'savecardpayment': $in["action"] = SAVVYEXT_USER_SAVECARDPAYMENT;
|
|
break;
|
|
case 'getlundrylocation': $in["action"] = SAVVYEXT_USER_LUNDRYLOCATION;
|
|
$in["limit"] = 100;
|
|
break;
|
|
|
|
case 'getmyservicelist': $in["action"] = SAVVYEXT_USER_GETSERVICELIST;
|
|
break;
|
|
|
|
case 'getoneserviceitem': $in["action"] = SAVVYEXT_USER_GETSERVICEITEM;
|
|
break;
|
|
|
|
case 'loadprofile': $in["action"] = SAVVY_USER_LOADUSERPROFILE;
|
|
|
|
if (!empty($inx) && is_array($inx)){
|
|
if (isset($inx['sessionid'])){
|
|
$inx['accessToken'] = $inx['sessionid'];
|
|
$resProfile = UserProfile::floatUserProfile($inx['accessToken']);
|
|
$this->logArray($resProfile);
|
|
$res = json_decode($resProfile, true);
|
|
$this->logArray($res);
|
|
}
|
|
}
|
|
break;
|
|
case 'deletecard': $in["action"] = SAVVYEXT_USER_DELETECARD;
|
|
break;
|
|
|
|
case 'getslidecarddata':
|
|
case 'getdashcarddata':
|
|
$inx["action"] = SAVVY_USERCARD_DASHCARD;
|
|
log_message('critical', "INTO ++ API-WAS CALLED getdashcarddata************************************ =>".$endpoint );
|
|
$this->logArray($inx);
|
|
log_message('critical', "INTO -- API-WAS CALLED ************************************ =>" );
|
|
$cards = new \App\Models\userCards();
|
|
$outX["action"] = $inx["action"];
|
|
$cards->loadSavedCard($inx, $outX);
|
|
$res = $this->processOutJson($outX, $outX);
|
|
|
|
log_message('critical', "OUT API-WAS CALLED getdashcarddata************************************ =>".$endpoint );
|
|
break;
|
|
|
|
|
|
case 'saveuserbudget':
|
|
$in["action"] = SAVVY_USER_SAVEBUDGET;
|
|
break;
|
|
|
|
case 'savedashcard':
|
|
$in["action"] = SAVVY_USERSAVE_DASHCARD;
|
|
$extension_call = false;
|
|
// saveDashCard($in, $out);
|
|
break;
|
|
|
|
case 'loadsavedcards':
|
|
$in["action"] = SAVVY_USERLOAD_SAVEDCARDS;
|
|
$extension_call = false;
|
|
//loadSavedCard($in, $out);
|
|
|
|
$outX["action"] = $in["action"];
|
|
$cards->loadSavedCard($in, $outX);
|
|
$res = $this->processOutJson($outX, $outX);
|
|
|
|
break;
|
|
|
|
case 'settingsarray':
|
|
$in["action"] = SAVVY_USERPROP_SETTINGSARRAY;
|
|
break;
|
|
|
|
case 'loadsubsription':
|
|
$in["action"] = SAVVY_USERSUSC_LOAD;
|
|
break;
|
|
|
|
|
|
}
|
|
//echo $res;
|
|
|
|
// $result = ['payload'=>$res]; only when encrypted
|
|
|
|
$result = $res; // when not encryped;
|
|
$this->logArray($result);
|
|
|
|
|
|
echo json_encode($result);
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
private function logArray($in){
|
|
if (!is_array($in)){
|
|
log_message('critical', "NOT ARRAY => $in \n");
|
|
return;
|
|
}
|
|
foreach($in as $key => $value){
|
|
$vl='';
|
|
if (is_array($value)){
|
|
foreach($value as $kk => $vv){
|
|
$vl .= "$kk => $vv \n";
|
|
}
|
|
}
|
|
else{
|
|
$vl=$value;
|
|
}
|
|
|
|
log_message('critical', "$key=>".$vl);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public function oauth2(){
|
|
log_message('critical', "API-WAS CALLED oauth2" );
|
|
return [];
|
|
}
|
|
|
|
public function banklogin(){
|
|
log_message('critical', "API-WAS CALLED banklogin" );
|
|
return [];
|
|
}
|
|
|
|
public function booking(){
|
|
log_message('critical', "API-WAS CALLED booking" );
|
|
|
|
return [];
|
|
}
|
|
|
|
|
|
public function advice(){
|
|
log_message('critical', "API-WAS CALLED advice" );
|
|
|
|
return [];
|
|
}
|
|
|
|
public function trips(){
|
|
log_message('critical', "API-WAS CALLED trips" );
|
|
|
|
return [];
|
|
}
|
|
|
|
public function blog(){
|
|
log_message('critical', "API-WAS CALLED blog" );
|
|
return [];
|
|
}
|
|
|
|
|
|
private function flatten($data, $parentkey="") {
|
|
$result = array();
|
|
if (!is_array($data) ){
|
|
return [];
|
|
}
|
|
foreach ($data as $key=>$val) {
|
|
if (is_array($val)) {
|
|
$result = array_merge($result, flatten($val, $parentkey.$key."_"));
|
|
} else {
|
|
$result[$parentkey.$key] = $val;
|
|
}
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
private function dummy_data(){
|
|
$out=[];
|
|
$out["internal_return"] = "100";
|
|
$out["firstname"] = "firstname";
|
|
$out["lastname"] = "lastname";
|
|
$out["session"] = "3333333777FFFFFFFFFFJJJJJJJJKKGFFFF";
|
|
$out["session_contructed"] = "3333333777FFFFFFFFFFJJJJJJJJKKGFFFF";
|
|
$out["username"] = "";
|
|
$out["last_login"] = "10-10-2021";
|
|
$out["member_id"] = "1";
|
|
$out["balance"] = "1000";
|
|
$out["added"] = "added";
|
|
$out["account_added"] = "10-10-2021";
|
|
$out["city"] = "Powder Springs";
|
|
$out["country"] = "US";
|
|
|
|
$out["email"] = "test@float.sg";
|
|
$out["fb_id"] = "";
|
|
$out["id"] = "1";
|
|
$out["loc"] = "192.168.1.1";
|
|
$out["news"] = "";
|
|
$out["phone"] = "";
|
|
$out["post_jobs"] = "";
|
|
$out["profile_pic"] = "";
|
|
$out["refer"] = "";
|
|
$out["state"] = "GA";
|
|
$out["status"] = "1";
|
|
$out["street1"] = "4202 defoors farm";
|
|
$out["zipcode"] = "30127";
|
|
$out["test"] = "0";
|
|
$out["points"] = "600000";
|
|
$out["min_budget"] = "10";
|
|
$out["max_budget"] = "10000";
|
|
$out["prompt_background_gps"] = "1";
|
|
return $out;
|
|
|
|
}
|
|
|
|
|
|
private function processOutJson($in, $out) {
|
|
/*
|
|
if ($in["action"] != MOBIDELIV_USER_GET_TRANSLIST) {
|
|
// return $out;
|
|
}
|
|
*/
|
|
switch ($in["action"]) {
|
|
|
|
case SAVVY_USERLOAD_SAVEDCARDS:
|
|
case SAVVY_USERSAPP_SLIDECARD:
|
|
case SAVVY_USERCARD_DASHCARD:
|
|
$total = $out["total_record"];
|
|
$res = array(
|
|
"session_valid" => $out["session_valid"],
|
|
"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(
|
|
"assign_id" => $out["assign_id_${key}"],
|
|
"card_id" => $out["card_id_${key}"],
|
|
"can_save" => $out["can_save_${key}"],
|
|
"name" => $out["name_${key}"],
|
|
"short_title" => $out["short_title_${key}"],
|
|
"title" => $out["title_${key}"],
|
|
"description" => $out["description_${key}"],
|
|
"background_picture" => $out["background_picture_${key}"],
|
|
"button1" => $out["button1_${key}"],
|
|
"button1_text" => $out["button1_text_${key}"],
|
|
"short_title" => $out["short_title_${key}"],
|
|
"button1_action" => $out["button1_action_${key}"],
|
|
"expires" => $out["expires_${key}"],
|
|
"template" => $out["template_${key}"],
|
|
"card_canexpire" => $out["card_canexpire_${key}"],
|
|
"card_action_type" => $out["card_action_type_${key}"],
|
|
"card_action_data" => $out["card_action_data_${key}"],
|
|
"titleshow" => $out["titleshow_${key}"],
|
|
"multiple_answer" => $out["multiple_answer_${key}"],
|
|
"use_short_title" => $out["use_short_title_${key}"],
|
|
"target_key" => $out["target_key_${key}"],
|
|
"target_text" => $out["target_text_${key}"],
|
|
"subscribe" => $out["subscribe_${key}"],
|
|
"long_description" => $out["long_description_${key}"],
|
|
"card_behavior" => $out["card_behavior_${key}"],
|
|
"card_type" => $out["card_type_${key}"],
|
|
"card_time" => $out["card_time_${key}"],
|
|
"card_country" => $out["card_country_${key}"],
|
|
"card_location" => $out["card_location_${key}"],
|
|
"latitude" => $out["latitude_${key}"],
|
|
"longitude" => $out["longitude_${key}"],
|
|
"card_order" => $out["card_order_${key}"],
|
|
"background_color" => $out["background_color_${key}"],
|
|
"blog_id" => $out["blog_id_${key}"],
|
|
"expiration" => $out["expiration_${key}"]
|
|
);
|
|
} // "request_id" => 324,
|
|
|
|
|
|
break;
|
|
|
|
case SAVVY_USERSAPP_LOADREDEEM:
|
|
$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(
|
|
"icon" => $out["icon_${key}"],
|
|
"redeem_id" => $out["redeem_id_${key}"],
|
|
"long_description" => $out["long_description_${key}"],
|
|
"points" => $out["points_${key}"],
|
|
"description" => $out["description_${key}"],
|
|
"key" => $out["key_${key}"]
|
|
);
|
|
} // "request_id" => 324,
|
|
|
|
|
|
break;
|
|
case SAVVY_USER_GETSAVEDTRIPS:
|
|
$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(
|
|
"trip_id" => $out["trip_id_${key}"],
|
|
"trip_name" => $out["trip_name_${key}"],
|
|
"to" => $out["to_${key}"],
|
|
"from" => $out["from_${key}"],
|
|
"trip_date" => $out["date_${key}"],
|
|
"color" => $out["color_${key}"]
|
|
);
|
|
} // "request_id" => 324,
|
|
|
|
break;
|
|
case SAVVY_USERSAPP_POINTSDEATAIL:
|
|
$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(
|
|
"name" => $out["name_${key}"],
|
|
"points" => $out["points_${key}"],
|
|
"added" => $out["added_${key}"],
|
|
"point_key" => $out["point_key_${key}"]
|
|
);
|
|
} // "request_id" => 324,
|
|
|
|
|
|
break;
|
|
|
|
case SAVVY_USER_TRANSPORTPROFILE:
|
|
|
|
$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}"],
|
|
"cost" => $out["cost_${key}"],
|
|
"name" => $out["name_${key}"]
|
|
);
|
|
} // "request_id" => 324,
|
|
|
|
|
|
break;
|
|
|
|
case SAVVY_USER_TRANSPORTLIST:
|
|
|
|
$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(
|
|
"travel_date" => $out["travel_date_${key}"],
|
|
"location_start" => $out["location_start_${key}"],
|
|
"location_end" => $out["location_end_${key}"],
|
|
"duration" => $out["duration_${key}"],
|
|
"cost" => $out["cost_${key}"],
|
|
"distance" => $out["distance_${key}"],
|
|
"transport_provider" => $out["transport_provider_id_${key}"],
|
|
"parsedemail_item_id" => $out["parsedemail_item_id_${key}"]
|
|
);
|
|
} // "request_id" => 324,
|
|
break;
|
|
/*
|
|
case MOBIDELIV_USER_GETCCLIST:
|
|
$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(
|
|
"paymentid" => $out["paymentid_${key}"],
|
|
"digits" => $out["digits_${key}"],
|
|
"description" => $out["description_${key}"],
|
|
"expiration_month" => $out["expiration_month_${key}"],
|
|
"expiration_year" => $out["expiration_year_${key}"]
|
|
);
|
|
} // "request_id" => 324,
|
|
|
|
break;
|
|
|
|
case MOBIDELIV_PROVIDER_TANSPORTLIST:
|
|
|
|
$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(
|
|
"transport_date" => $out["transport_date_${key}"],
|
|
"transport_time" => $out["transport_time_${key}"],
|
|
"firstname" => $out["firstname_${key}"],
|
|
"lastname" => $out["lastname_${key}"],
|
|
"from_phone" => $out["from_phone_${key}"],
|
|
"from_street" => $out["from_street_${key}"],
|
|
"to_street" => $out["to_street_${key}"],
|
|
"from_city" => $out["from_city_${key}"],
|
|
"to_city" => $out["to_city_${key}"],
|
|
"from_state" => $out["from_state_${key}"],
|
|
"to_state" => $out["to_state_${key}"],
|
|
"from_zipcode" => $out["from_zipcode_${key}"],
|
|
"to_zipcode" => $out["to_zipcode_${key}"],
|
|
"miles" => $out["distance_${key}"],
|
|
"id" => $out["id_${key}"],
|
|
"request_id" => $out["id_${key}"],
|
|
"status" => $out["status_${key}"],
|
|
"status_description" => $out["status_description_${key}"],
|
|
"assign_date" => $out["assign_date_${key}"],
|
|
"dist_mode" => $out["dist_mode_${key}"],
|
|
"needwheelchair" => $out["needwheelchair_${key}"],
|
|
"abilitytowalk" => $out["abilitytowalk_${key}"],
|
|
"conciergeneeded" => $out["conciergeneeded_${key}"],
|
|
"courtappearance" => $out["courtappearance_${key}"]
|
|
);
|
|
} // "request_id" => 324,
|
|
break;
|
|
case MOBIDELIV_PROVIDER_TRANSLATEIST:
|
|
|
|
$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(
|
|
"transport_date" => $out["transport_date_${key}"],
|
|
"transport_time" => $out["transport_time_${key}"],
|
|
"firstname" => $out["firstname_${key}"],
|
|
"lastname" => $out["lastname_${key}"],
|
|
"from_phone" => $out["from_phone_${key}"],
|
|
"from_street" => $out["from_street_${key}"],
|
|
"to_street" => $out["to_street_${key}"],
|
|
"from_city" => $out["from_city_${key}"],
|
|
"to_city" => $out["to_city_${key}"],
|
|
"from_state" => $out["from_state_${key}"],
|
|
"to_state" => $out["to_state_${key}"],
|
|
"from_zipcode" => $out["from_zipcode_${key}"],
|
|
"to_zipcode" => $out["to_zipcode_${key}"],
|
|
"miles" => $out["distance_${key}"],
|
|
"id" => $out["id_${key}"],
|
|
"request_id" => $out["id_${key}"],
|
|
"status" => $out["status_${key}"],
|
|
"status_description" => $out["status_description_${key}"],
|
|
"lang_code" => $out["lang_code_${key}"],
|
|
"language" => $out["language_${key}"],
|
|
"status" => $out["status_${key}"],
|
|
"assign_date" => $out["assign_date_${key}"],
|
|
"courtappearance" => $out["courtappearance_${key}"],
|
|
"dt_confirmed" => $out["dt_confirmed_${key}"],
|
|
"dt_rejected" => $out["dt_rejected_${key}"],
|
|
"language" => $out["language_${key}"],
|
|
"flags" => $out["flags_${key}"]
|
|
);
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MOBIDELIV_USER_GET_TRANSLLIST:
|
|
|
|
$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(
|
|
"transport_date" => $out["transport_date_${key}"],
|
|
"transport_time" => $out["transport_time_${key}"],
|
|
"firstname" => $out["firstname_${key}"],
|
|
"lastname" => $out["lastname_${key}"],
|
|
"from_phone" => $out["from_phone_${key}"],
|
|
"from_street" => $out["from_street_${key}"],
|
|
"to_street" => $out["to_street_${key}"],
|
|
"from_city" => $out["from_city_${key}"],
|
|
"to_city" => $out["to_city_${key}"],
|
|
"from_state" => $out["from_state_${key}"],
|
|
"to_state" => $out["to_state_${key}"],
|
|
"from_zipcode" => $out["from_zipcode_${key}"],
|
|
"to_zipcode" => $out["to_zipcode_${key}"],
|
|
"miles" => $out["distance_${key}"],
|
|
"transport" => $out["transport_${key}"],
|
|
"translate" => $out["translate_${key}"],
|
|
"id" => $out["id_${key}"],
|
|
"lang_code" => $out["lang_code_${key}"],
|
|
"language" => $out["language_${key}"],
|
|
"status" => $out["status_${key}"],
|
|
"assign_date" => $out["assign_date_${key}"],
|
|
"dist_mode" => $out["dist_mode_${key}"],
|
|
"needwheelchair" => $out["needwheelchair_${key}"],
|
|
"abilitytowalk" => $out["abilitytowalk_${key}"],
|
|
"conciergeneeded" => $out["conciergeneeded_${key}"],
|
|
"courtappearance" => $out["courtappearance_${key}"],
|
|
"dt_confirmed" => $out["dt_confirmed_${key}"],
|
|
"dt_rejected" => $out["dt_rejected_${key}"],
|
|
"language" => $out["language_${key}"],
|
|
"interpreter_id" => $out["interpreter_id_${key}"],
|
|
"flags" => $out["flags_${key}"]
|
|
);
|
|
}
|
|
break;
|
|
|
|
case MOBIDELIV_USER_GETSERVICELIST:
|
|
|
|
$total = $out["total_record"];
|
|
$res = array(
|
|
"status" => $out["status"],
|
|
"total_record" => ($total - 1),
|
|
"internal_return" => $out["internal_return"],
|
|
"result_list" => array(),
|
|
);
|
|
for ($i = 0; $i < $total; $i++) {
|
|
$key = sprintf("%05d", $i);
|
|
$res["result_list"][] = array(
|
|
"service_date" => $out["service_date_${key}"],
|
|
"long_date" => $out["long_date_${key}"],
|
|
"service_id" => $out["service_id_${key}"],
|
|
"agent_name" => $out["agent_name_${key}"],
|
|
"flags" => $out["flags_${key}"],
|
|
"status" => $out["status_${key}"],
|
|
"quantity" => $out["quantity_${key}"],
|
|
"confirm_text" => $out["confirm_text_${key}"],
|
|
"flag_text" => $out["flag_text_${key}"],
|
|
"service_fee" => $out["service_fee_${key}"],
|
|
"service_type_description" => $out["stype_desc_${key}"],
|
|
"service_list_detail" => $out["service_list_detail_${key}"]
|
|
);
|
|
}
|
|
|
|
break;
|
|
case MOBIDELIV_USER_GET_LANGUAGE:
|
|
$total = $out["total_record"];
|
|
$res = array(
|
|
"status" => $out["status"],
|
|
"total_record" => ($total - 1),
|
|
"internal_return" => $out["internal_return"],
|
|
"result_list" => array(),
|
|
);
|
|
for ($i = 0; $i < $total; $i++) {
|
|
$key = sprintf("%05d", $i);
|
|
$res["result_list"][] = array(
|
|
"language" => $out["language_${key}"],
|
|
"code" => $out["code_${key}"]
|
|
);
|
|
}
|
|
break;
|
|
|
|
case MOBIDELIV_TRANSP_LISTLOCATION:
|
|
|
|
$total = $out["total_record"];
|
|
$res = array(
|
|
"status" => $out["status"],
|
|
"total_record" => ($total - 1),
|
|
"internal_return" => $out["internal_return"],
|
|
"result_list" => array(),
|
|
);
|
|
for ($i = 0; $i < $total; $i++) {
|
|
$key = sprintf("%05d", $i);
|
|
$res["result_list"][] = array(
|
|
"agent_id" => $out["agent_id_${key}"],
|
|
"street" => $out["street_${key}"],
|
|
"city" => $out["city_${key}"],
|
|
"id" => $out["id_${key}"],
|
|
"state" => $out["state_${key}"],
|
|
"zipcode" => $out["zipcode_${key}"],
|
|
"state" => $out["state_${key}"]
|
|
);
|
|
}
|
|
|
|
break;
|
|
case MOBIDELIV_USER_GET_INVOICE:
|
|
|
|
break;
|
|
|
|
case MOBIDELIV_TRANSP_GETREASON:
|
|
|
|
$total = $out["total_record"];
|
|
$res = array(
|
|
"status" => $out["status"],
|
|
"total_record" => ($total - 1),
|
|
"internal_return" => $out["internal_return"],
|
|
"result_list" => array(),
|
|
);
|
|
for ($i = 0; $i < $total; $i++) {
|
|
$key = sprintf("%05d", $i);
|
|
$res["result_list"][] = array(
|
|
"key" => $out["lkey_${key}"],
|
|
"name" => $out["name_${key}"],
|
|
"lorder" => $out["lorder_${key}"]
|
|
);
|
|
}
|
|
|
|
|
|
break;
|
|
*/
|
|
default:
|
|
return $out;
|
|
}
|
|
|
|
return $res;
|
|
}
|
|
|
|
|
|
}
|