Saved cars
This commit is contained in:
@@ -21,8 +21,35 @@ class Savvy extends BaseController
|
|||||||
log_message('critical', "API-WAS CALLED" );
|
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(){
|
public function user(){
|
||||||
|
// ini_set("memory_limit","1024M");
|
||||||
|
ini_set('memory_limit', '-1');
|
||||||
|
//$this-> testCards();
|
||||||
|
|
||||||
/*encryption:
|
/*encryption:
|
||||||
{
|
{
|
||||||
@@ -271,6 +298,11 @@ class Savvy extends BaseController
|
|||||||
$in["action"] = SAVVY_USERCARD_DASHCARD;
|
$in["action"] = SAVVY_USERCARD_DASHCARD;
|
||||||
log_message('critical', "INTO API-WAS CALLED user************************************ =>".$endpoint );
|
log_message('critical', "INTO API-WAS CALLED user************************************ =>".$endpoint );
|
||||||
$this->logArray($inx);
|
$this->logArray($inx);
|
||||||
|
|
||||||
|
$outX["action"] = $in["action"];
|
||||||
|
$cards->loadSavedCard($in, $outX);
|
||||||
|
$res = $this->processOutJson($outX, $outX);
|
||||||
|
|
||||||
log_message('critical', "OUT API-WAS CALLED user************************************ =>".$endpoint );
|
log_message('critical', "OUT API-WAS CALLED user************************************ =>".$endpoint );
|
||||||
break;
|
break;
|
||||||
case 'getslidecarddata':
|
case 'getslidecarddata':
|
||||||
@@ -278,6 +310,12 @@ class Savvy extends BaseController
|
|||||||
$extension_call = false;
|
$extension_call = false;
|
||||||
$cards = new \App\Models\userCards();
|
$cards = new \App\Models\userCards();
|
||||||
//loadSliderCard($in, $out);
|
//loadSliderCard($in, $out);
|
||||||
|
|
||||||
|
$outX["action"] = $in["action"];
|
||||||
|
$cards->loadSavedCard($in, $outX);
|
||||||
|
$res = $this->processOutJson($outX, $outX);
|
||||||
|
|
||||||
|
|
||||||
log_message('critical', "INTO API-WAS CALLED user************************************ =>".$endpoint );
|
log_message('critical', "INTO API-WAS CALLED user************************************ =>".$endpoint );
|
||||||
$this->logArray($inx);
|
$this->logArray($inx);
|
||||||
log_message('critical', "OUT API-WAS CALLED user************************************ =>".$endpoint );
|
log_message('critical', "OUT API-WAS CALLED user************************************ =>".$endpoint );
|
||||||
@@ -296,6 +334,11 @@ class Savvy extends BaseController
|
|||||||
$in["action"] = SAVVY_USERLOAD_SAVEDCARDS;
|
$in["action"] = SAVVY_USERLOAD_SAVEDCARDS;
|
||||||
$extension_call = false;
|
$extension_call = false;
|
||||||
//loadSavedCard($in, $out);
|
//loadSavedCard($in, $out);
|
||||||
|
|
||||||
|
$outX["action"] = $in["action"];
|
||||||
|
$cards->loadSavedCard($in, $outX);
|
||||||
|
$res = $this->processOutJson($outX, $outX);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'settingsarray':
|
case 'settingsarray':
|
||||||
@@ -432,4 +475,432 @@ $vl='';
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+59
-134
@@ -41,9 +41,10 @@ class userCards extends Model{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getMember($member){
|
private function getMember($member_id){
|
||||||
|
$in['member_id'] = $member_id;
|
||||||
return [];
|
$in['id'] = $member_id;
|
||||||
|
return $in;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getCardBySurvey($member)
|
private function getCardBySurvey($member)
|
||||||
@@ -57,7 +58,7 @@ class userCards extends Model{
|
|||||||
AND card_id NOT IN (SELECT card_id FROM members_card_assign WHERE member_id =" . $member_id . " AND status=1)
|
AND card_id NOT IN (SELECT card_id FROM members_card_assign WHERE member_id =" . $member_id . " AND status=1)
|
||||||
GROUP BY card_id";
|
GROUP BY card_id";
|
||||||
|
|
||||||
$query = $db->query( $q );
|
$query = $this->db->query( $q );
|
||||||
if ( $query && $query->getNumRows() && $f = $query->getRowArray()) {
|
if ( $query && $query->getNumRows() && $f = $query->getRowArray()) {
|
||||||
return $f;
|
return $f;
|
||||||
}
|
}
|
||||||
@@ -66,8 +67,9 @@ class userCards extends Model{
|
|||||||
|
|
||||||
private function getCardsByType(&$out, $member, $card_type, $limit = 10)
|
private function getCardsByType(&$out, $member, $card_type, $limit = 10)
|
||||||
{
|
{
|
||||||
global $pgconn;
|
|
||||||
$member_id = $member['id'];
|
$member_id = $member['id'];
|
||||||
|
$query ='';
|
||||||
|
|
||||||
switch ($card_type) {
|
switch ($card_type) {
|
||||||
case 33000:
|
case 33000:
|
||||||
$query = "SELECT ca.id AS assign_id, ca.subscribe, a.*, a.id AS card_id,b.name AS card_action_name,b.type AS card_action_type,b.data AS card_action_data,adr.latitude,adr.longitude,
|
$query = "SELECT ca.id AS assign_id, ca.subscribe, a.*, a.id AS card_id,b.name AS card_action_name,b.type AS card_action_type,b.data AS card_action_data,adr.latitude,adr.longitude,
|
||||||
@@ -107,138 +109,30 @@ class userCards extends Model{
|
|||||||
$deal_card_count = 0;
|
$deal_card_count = 0;
|
||||||
$survey_card_count = 0;
|
$survey_card_count = 0;
|
||||||
$blog_card_count = 0;
|
$blog_card_count = 0;
|
||||||
//$r = pg_query($pgconn, $query);
|
$r = $this->db->query( $query );
|
||||||
$r = $db->query( $query );
|
|
||||||
$out['total_record_raw'] = $r->getNumRows();
|
$out['total_record_raw'] = $r->getNumRows();
|
||||||
$out['total_record'] = $r->getNumRows();
|
$out['total_record'] = $r->getNumRows();
|
||||||
$out['retval'] = PHP_API_OK;
|
$out['retval'] = PHP_API_OK;
|
||||||
$out['internal_return'] = PHP_API_OK;
|
$out['internal_return'] = PHP_API_OK;
|
||||||
$query = $query . " LIMIT " . $limit . "";
|
$query = $query . " LIMIT " . $limit . "";
|
||||||
$r = $db->query( $query ); // with limits
|
$r = $this->db->query( $query ); // with limits
|
||||||
$result = [];
|
$result = [];
|
||||||
if ($r && $total_record_raw = $r->getNumRows()) {
|
|
||||||
|
if ($r) {
|
||||||
$ic = 0;
|
$ic = 0;
|
||||||
while ($f = $r->getRowArray()) {
|
while ($f = $r->getRowArray()) {
|
||||||
$test_card_allowed = CARD_ADD_ALLOWED;
|
|
||||||
if ($card_type == 22000) {
|
|
||||||
$test_card_allowed = $this->verifyMemberCardDescision($f, $member, $out);
|
|
||||||
}
|
|
||||||
$card_country_allow = true;
|
|
||||||
|
|
||||||
if ($f["card_country"] != "") {
|
|
||||||
$card_country_allow = false;
|
|
||||||
|
|
||||||
if ($f["card_country"] == $member["country"]) {
|
|
||||||
$card_country_allow = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$count_block = false;
|
|
||||||
|
|
||||||
// let see i card expired
|
|
||||||
$expr_value = $f["expr_val"];
|
|
||||||
if ($f["card_canexpire"] == 1 && $expr_value < 0) {
|
|
||||||
$count_block = true;
|
|
||||||
} else {
|
|
||||||
if ($card_type == 22000) {
|
|
||||||
|
|
||||||
if ($f["button1_action"] == "GOOFFERS") {
|
|
||||||
if ($deal_card_count > 0) {
|
|
||||||
$count_block = true;
|
|
||||||
}
|
|
||||||
if ($f["card_country"] == "" || $f["card_country"] == $member["country"]) {
|
|
||||||
$deal_card_count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($f["button1_action"] == "SURVEYA") {
|
|
||||||
if ($fsurvey_card_count > 0) {
|
|
||||||
$count_block = true;
|
|
||||||
}
|
|
||||||
$survey_card_count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($f["button1_action"] == "BLOGCARD") {
|
|
||||||
if ($blog_card_count > 0) {
|
|
||||||
$count_block = true;
|
|
||||||
}
|
|
||||||
$blog_card_count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} //card is not expired
|
|
||||||
|
|
||||||
if (CARD_ADD_ALLOWED == $test_card_allowed && true == $card_country_allow && false == $count_block) {
|
|
||||||
$suffix = str_pad($ic, 5, '0', STR_PAD_LEFT);
|
|
||||||
//fillSuffixCard($out, $f, $suffix);
|
|
||||||
$out['name_' . $suffix] = $f['name'];
|
|
||||||
$out['assign_id_' . $suffix] = $f['assign_id'];
|
|
||||||
$out['card_id_' . $suffix] = $f['card_id'];
|
|
||||||
$out['can_save_' . $suffix] = $f['can_save'];
|
|
||||||
$out['short_title_' . $suffix] = $f['short_title'];
|
|
||||||
$out['title_' . $suffix] = $f['short_title'];
|
|
||||||
$out['background_picture_' . $suffix] = $f['background_picture'];
|
|
||||||
$out['button1_' . $suffix] = $f['button1'];
|
|
||||||
$out['button1_text_' . $suffix] = $f['button1_text'];
|
|
||||||
$out['button1_action_' . $suffix] = $f['button1_action'];
|
|
||||||
$out['expires_' . $suffix] = $f['card_expiration'];
|
|
||||||
$out['template_' . $suffix] = $f['template'];
|
|
||||||
$out['card_canexpire_' . $suffix] = $f['card_canexpire'];
|
|
||||||
$out['card_action_type_' . $suffix] = $f['card_action_type'];
|
|
||||||
$out['card_action_data_' . $suffix] = $f['card_action_data'];
|
|
||||||
$out['titleshow_' . $suffix] = $f['titleshow'];
|
|
||||||
$out['multiple_answer_' . $suffix] = $f['multiple_answer'];
|
|
||||||
$out['use_short_title_' . $suffix] = $f['use_short_title'];
|
|
||||||
$out['target_key_' . $suffix] = $f['target_key'];
|
|
||||||
$out['target_text_' . $suffix] = $f['target_text'];
|
|
||||||
$out['description_' . $suffix] = $f['description'];
|
|
||||||
$out['long_description_' . $suffix] = $f['long_description'];
|
|
||||||
$out['card_behavior_' . $suffix] = $f['card_behavior'];
|
|
||||||
$out['card_type_' . $suffix] = $f['card_type'];
|
|
||||||
$out['card_time_' . $suffix] = $f['card_time'];
|
|
||||||
$out['card_country_' . $suffix] = $f['card_country'];
|
|
||||||
$out['card_location_' . $suffix] = $f['card_location'];
|
|
||||||
$out['latitude_' . $suffix] = $f['latitude'];
|
|
||||||
$out['longitude_' . $suffix] = $f['longitude'];
|
|
||||||
$out['card_order_' . $suffix] = $f['card_order'];
|
|
||||||
$out['background_color_' . $suffix] = $f['background_color'];
|
|
||||||
$out['blog_id_' . $suffix] = $f['blog_id'];
|
|
||||||
$out['expiration_' . $suffix] = $f['expiration'];
|
|
||||||
if ($f["button1_action"] == "CARPOOL") {
|
|
||||||
|
|
||||||
$carPool = fetchRow("SELECT * FROM members_carpool_friends WHERE carpool_id IN (select id from members_carpool WHERE member_id = " . $member_id . ") AND status = 1");
|
|
||||||
|
|
||||||
if ($carPool && $carPool['added']) {
|
|
||||||
$out['subscribe_' . $suffix] = $carPool["added"];
|
|
||||||
} else {
|
|
||||||
$out['subscribe_' . $suffix] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$out['subscribe_' . $suffix] = $f["subscribe"];
|
|
||||||
}
|
|
||||||
$ic++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$out['total_record'] = $ic;
|
$out['total_record'] = $ic;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function verifyMemberCardDescision($cardData, $memberData, &$out)
|
|
||||||
{
|
|
||||||
$permCard = CARD_ADD_ALLOWED;
|
|
||||||
$behaviour = $cardData["card_behavior"];
|
|
||||||
|
|
||||||
if (function_exists("behaviour_" . $behaviour)) {
|
|
||||||
$permCard = call_user_func("behaviour_" . $behaviour, $memberData, $out);
|
|
||||||
} else {
|
|
||||||
$permCard = CARD_ADD_ALLOWED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $permCard;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function saveDashCard($in, &$out)
|
private function saveDashCard($in, &$out)
|
||||||
{
|
{
|
||||||
@@ -258,7 +152,29 @@ class userCards extends Model{
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSavedCard($in, &$out)
|
private function logArray2($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 loadSavedCard($in, &$out)
|
||||||
{
|
{
|
||||||
$ret = PHP_API_BAD_PARAM;
|
$ret = PHP_API_BAD_PARAM;
|
||||||
|
|
||||||
@@ -267,12 +183,20 @@ class userCards extends Model{
|
|||||||
$out["total_record"] = 0;
|
$out["total_record"] = 0;
|
||||||
$out['session_valid'] = '';
|
$out['session_valid'] = '';
|
||||||
$out['internal_return'] = PHP_API_OK;
|
$out['internal_return'] = PHP_API_OK;
|
||||||
$saveCards = selectData("SELECT m.id AS saved_card_id, mc.*,mc.id AS card_id FROM member_saved_cards m LEFT JOIN main_cards mc ON m.card_id = mc.id WHERE m.member_id = " . $member_id . " AND m.status = 1");
|
$saveCards = $this->db->query("SELECT m.id AS saved_card_id, mc.*,mc.id AS card_id
|
||||||
|
FROM member_saved_cards m
|
||||||
|
LEFT JOIN main_cards mc ON m.card_id = mc.id
|
||||||
|
WHERE m.member_id = " . $member_id . "
|
||||||
|
AND m.status = 1 LIMIT 10");
|
||||||
|
// $this->logArray2($saveCards);
|
||||||
if ($saveCards != null) {
|
if ($saveCards != null) {
|
||||||
$out["total_record"] = pg_num_rows($saveCards);
|
$out["total_record"] = $saveCards->getNumRows();
|
||||||
$ic = 0;
|
$ic = 0;
|
||||||
|
$this->logArray2("card lines total_record => ".$saveCards->getNumRows());
|
||||||
while ($f = pg_fetch_assoc($saveCards)) {
|
|
||||||
|
|
||||||
|
foreach ($saveCards->getResultArray() as $f) {
|
||||||
|
$this->logArray2("card lines total => ".$ic);
|
||||||
$suffix = str_pad($ic, 5, '0', STR_PAD_LEFT);
|
$suffix = str_pad($ic, 5, '0', STR_PAD_LEFT);
|
||||||
$out['name_' . $suffix] = $f['name'];
|
$out['name_' . $suffix] = $f['name'];
|
||||||
$out['short_title_' . $suffix] = $f['short_title'];
|
$out['short_title_' . $suffix] = $f['short_title'];
|
||||||
@@ -295,6 +219,7 @@ class userCards extends Model{
|
|||||||
$out['titleshow_' . $suffix] = $f['titleshow'];
|
$out['titleshow_' . $suffix] = $f['titleshow'];
|
||||||
$ic++;
|
$ic++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$ret = PHP_API_OK;
|
$ret = PHP_API_OK;
|
||||||
$out["status"] = "OK";
|
$out["status"] = "OK";
|
||||||
@@ -327,11 +252,11 @@ class userCards extends Model{
|
|||||||
$card = fetchRow("SELECT id,button1_action,title,expiration FROM main_cards WHERE id=" . $card_id . "");
|
$card = fetchRow("SELECT id,button1_action,title,expiration FROM main_cards WHERE id=" . $card_id . "");
|
||||||
if ($card) {
|
if ($card) {
|
||||||
if ($card["button1_action"] == "CARPOOL") {
|
if ($card["button1_action"] == "CARPOOL") {
|
||||||
updateQuery("UPDATE members_card_assign SET status = 0,completed=now(),updated=now() WHERE card_id=" . $card_id . " AND member_id=" . $member_id . "");
|
$this->db->query("UPDATE members_card_assign SET status = 0,completed=now(),updated=now() WHERE card_id=" . $card_id . " AND member_id=" . $member_id . "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($card["expiration"] == 100) {
|
if ($card["expiration"] == 100) {
|
||||||
updateQuery("UPDATE members_card_assign SET status = 0,updated=now() WHERE card_id=" . $card_id . " AND member_id=" . $member_id . "");
|
$this->db->query("UPDATE members_card_assign SET status = 0,updated=now() WHERE card_id=" . $card_id . " AND member_id=" . $member_id . "");
|
||||||
}
|
}
|
||||||
|
|
||||||
// let us see if this is a dynamic card
|
// let us see if this is a dynamic card
|
||||||
@@ -341,7 +266,7 @@ class userCards extends Model{
|
|||||||
if ($assignCard) {
|
if ($assignCard) {
|
||||||
if ($assignCard["expiration"] == "EXP00002") {
|
if ($assignCard["expiration"] == "EXP00002") {
|
||||||
// rule 1 expire on first contact
|
// rule 1 expire on first contact
|
||||||
updateQuery("UPDATE members_card_assign SET status = 0 WHERE id= " . $assignCard['assign_id'] . " AND member_id=" . $member_id . "");
|
$this->db->query("UPDATE members_card_assign SET status = 0 WHERE id= " . $assignCard['assign_id'] . " AND member_id=" . $member_id . "");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -364,7 +289,7 @@ class userCards extends Model{
|
|||||||
} else {
|
} else {
|
||||||
$ret = PHP_API_OK;
|
$ret = PHP_API_OK;
|
||||||
}
|
}
|
||||||
$ret = updateQuery("UPDATE members_card_assign SET status = 1, updated=NOW() WHERE id = " . $assignCard['assign_id'] . " AND member_id = " . $member_id . "");
|
$ret = $this->db->query("UPDATE members_card_assign SET status = 1, updated=NOW() WHERE id = " . $assignCard['assign_id'] . " AND member_id = " . $member_id . "");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$out["status"] = "This card was already added";
|
$out["status"] = "This card was already added";
|
||||||
|
|||||||
Reference in New Issue
Block a user