|
|
@@ -2,9 +2,10 @@
|
|
|
|
|
|
class api_model extends Model {
|
|
|
|
|
|
- //private $API = 'https://szollosil.bbus.smbinfo.hu/api/index.php';
|
|
|
- private $API = 'https://hoponticket.com/api/index.php';
|
|
|
+ //private $API = 'https://hoponticket.com/api/index.php';
|
|
|
+ private API = 'https://preprod2.bbus.umsbox.hu/api/index.php';
|
|
|
//private $API = 'https://php82fpm.umsbox.hu/api/index.php';
|
|
|
+ //private $API = 'https://szollosil.bbus.umsbox.hu/api/index.php';
|
|
|
|
|
|
private $API_KEY = '92JxvN5Zeti4E1FDwKg0QPEl3md4vY63';
|
|
|
|
|
|
@@ -78,7 +79,7 @@ class api_model extends Model {
|
|
|
public function getEventsList($groupID, $eventID='') {
|
|
|
$curl = curl_init();
|
|
|
curl_setopt_array($curl, array(
|
|
|
- CURLOPT_URL => $this->API.'/affiliateapi/events?group_id='.$groupID.'&groupByDate=1',
|
|
|
+ CURLOPT_URL => $this->API.'/affiliateapi/events?group_id='.$groupID.'&additionalDate=60&groupByDate=1',
|
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
|
CURLOPT_ENCODING => '',
|
|
|
CURLOPT_MAXREDIRS => 10,
|
|
|
@@ -127,7 +128,7 @@ class api_model extends Model {
|
|
|
public function getEventsListByGroup($groupID, $eventID) {
|
|
|
$curl = curl_init();
|
|
|
curl_setopt_array($curl, array(
|
|
|
- CURLOPT_URL => $this->API.'/affiliateapi/events?group_id='.$groupID.'&groupByDate=1',
|
|
|
+ CURLOPT_URL => $this->API.'/affiliateapi/events?group_id='.$groupID.'&additionalDate=60&groupByDate=1',
|
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
|
CURLOPT_ENCODING => '',
|
|
|
CURLOPT_MAXREDIRS => 10,
|
|
|
@@ -176,7 +177,7 @@ class api_model extends Model {
|
|
|
private function getAllEventsListByGroup($groupID) {
|
|
|
$curl = curl_init();
|
|
|
curl_setopt_array($curl, array(
|
|
|
- CURLOPT_URL => $this->API.'/affiliateapi/events?group_id='.$groupID.'&groupByDate=1',
|
|
|
+ CURLOPT_URL => $this->API.'/affiliateapi/events?group_id='.$groupID.'&additionalDate=60&groupByDate=1',
|
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
|
CURLOPT_ENCODING => '',
|
|
|
CURLOPT_MAXREDIRS => 10,
|
|
|
@@ -192,6 +193,8 @@ class api_model extends Model {
|
|
|
curl_close($curl);
|
|
|
$eventsByKey = [];
|
|
|
$response = json_decode($response, true);
|
|
|
+ //print_r($response);
|
|
|
+ //die();
|
|
|
foreach ($response as $key => $item) {
|
|
|
$event = [];
|
|
|
$event['key'] = $key;
|
|
|
@@ -254,7 +257,7 @@ class api_model extends Model {
|
|
|
$curl = curl_init();
|
|
|
|
|
|
curl_setopt_array($curl, array(
|
|
|
- CURLOPT_URL => $this->API.'/affiliateapi/events?id='.$packageid.'&participants='.$participants,
|
|
|
+ CURLOPT_URL => $this->API.'/affiliateapi/events?id='.$packageid.'&additionalDate=60&participants='.$participants,
|
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
|
CURLOPT_ENCODING => '',
|
|
|
CURLOPT_MAXREDIRS => 10,
|
|
|
@@ -1051,6 +1054,53 @@ class api_model extends Model {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public function getPreviousUUID($uuid) {
|
|
|
+ $uuid = $this->escapeString($uuid);
|
|
|
+ $rows = $this->query("SELECT previous_uuid FROM `azonics_user_events`
|
|
|
+ WHERE uuid = '".$uuid."' AND event_type = 'uuid_change'
|
|
|
+ ORDER BY event_id DESC LIMIT 1;");
|
|
|
+ if (count($rows) > 0 && !empty($rows[0]->previous_uuid)) {
|
|
|
+ return $rows[0]->previous_uuid;
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+
|
|
|
+ public function logUserEvent($data) {
|
|
|
+ $uuid = $this->escapeString($data['uuid']);
|
|
|
+ $event_type = $this->escapeString($data['event_type']);
|
|
|
+
|
|
|
+ if ($event_type === 'uuid_change') {
|
|
|
+ $previous_uuid = isset($data['previous_uuid']) ? $this->escapeString($data['previous_uuid']) : '';
|
|
|
+ } else {
|
|
|
+ $previous_uuid = $this->getPreviousUUID($data['uuid']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $hotel = isset($data['hotel']) ? $this->escapeString($data['hotel']) : '';
|
|
|
+ $order_id = isset($data['order_id']) ? $this->escapeString($data['order_id']) : '';
|
|
|
+ $cart = isset($data['cart']) ? $this->escapeString(json_encode($data['cart'])) : '';
|
|
|
+ $event_name = $this->escapeString($data['event_name']);
|
|
|
+ $event_data = isset($data['data']) ? $this->escapeString(json_encode($data['data'])) : '';
|
|
|
+ $page_url = isset($data['page_url']) ? $this->escapeString($data['page_url']) : '';
|
|
|
+ $ip_address = $this->escapeString($_SERVER['REMOTE_ADDR']);
|
|
|
+ $user_agent = $this->escapeString($_SERVER['HTTP_USER_AGENT'] ?? '');
|
|
|
+
|
|
|
+ $this->execute("INSERT INTO `azonics_user_events` SET
|
|
|
+ uuid = '".$uuid."',
|
|
|
+ previous_uuid = '".$previous_uuid."',
|
|
|
+ hotel = '".$hotel."',
|
|
|
+ order_id = '".$order_id."',
|
|
|
+ cart = '".$cart."',
|
|
|
+ event_type = '".$event_type."',
|
|
|
+ event_name = '".$event_name."',
|
|
|
+ event_data = '".$event_data."',
|
|
|
+ page_url = '".$page_url."',
|
|
|
+ ip_address = '".$ip_address."',
|
|
|
+ user_agent = '".$user_agent."',
|
|
|
+ created_at = NOW();");
|
|
|
+
|
|
|
+ return $this->getLastInsertID();
|
|
|
+ }
|
|
|
+
|
|
|
public function getQRCodes($orderID) {
|
|
|
$curl = curl_init();
|
|
|
|