Commit 588b5092 by Tobin

Merge branch 'master' of https://gitlab.techware.co.in/timeout/timeOut into tobin

parents 85dd8131 5eb52171
...@@ -666,9 +666,10 @@ class Api_model extends CI_Model { ...@@ -666,9 +666,10 @@ class Api_model extends CI_Model {
if($status == 1){ if($status == 1){
$sql = "SELECT TEVT.event_name,CUST.name,CUST.email,CUST.phone, $sql = "SELECT TEVT.event_name,CUST.name,CUST.email,CUST.phone,
CONCAT(EDATE.date,' ',EDATE.time) AS show_time CONCAT(EDATE.date,' ',EDATE.time) AS show_time,PDR.fcm_token
FROM booking AS BK FROM booking AS BK
INNER JOIN events AS EVT ON (EVT.event_id=BK.event_id) INNER JOIN events AS EVT ON (EVT.event_id=BK.event_id)
INNER JOIN provider AS PDR ON (PDR.provider_id=EVT.provider_id)
INNER JOIN customer AS CUST ON (CUST.customer_id=BK.customer_id) INNER JOIN customer AS CUST ON (CUST.customer_id=BK.customer_id)
INNER JOIN event_date_time AS EDATE ON (EDATE.id=BK.event_date_id) INNER JOIN event_date_time AS EDATE ON (EDATE.id=BK.event_date_id)
INNER JOIN translator_event AS TEVT ON (TEVT.event_id=EVT.event_id) INNER JOIN translator_event AS TEVT ON (TEVT.event_id=EVT.event_id)
...@@ -699,6 +700,12 @@ class Api_model extends CI_Model { ...@@ -699,6 +700,12 @@ class Api_model extends CI_Model {
$template['booking_sms']); $template['booking_sms']);
} }
$this->sendSMS($bkData['phone'],$msgContent); $this->sendSMS($bkData['phone'],$msgContent);
if($post_data['status'] == 6){
$userData = array('id'=>$post_data['event_id'],
'title'=>'New Booking',
'message'=>'New Booking is There For Approval');
$this->push_sent_cancel($bkData['fcm_token'],$userData);
}
} }
} else { } else {
$res = array('status'=>0,'message'=>'Seat booking failed','code'=>'ER37'); $res = array('status'=>0,'message'=>'Seat booking failed','code'=>'ER37');
...@@ -716,6 +723,24 @@ class Api_model extends CI_Model { ...@@ -716,6 +723,24 @@ class Api_model extends CI_Model {
return 'https://www.barcodefaq.com/wp-content/uploads/2018/08/gs1-qrcode-fnc1.png'; return 'https://www.barcodefaq.com/wp-content/uploads/2018/08/gs1-qrcode-fnc1.png';
} }
public function push_sent_cancel($fcm_token='', $fcm_data=array()) {
$settings = getSettings();
$key = $settings['app_id'];
if(empty($key) || empty($fcm_token) || empty($fcm_data)){
return;
}
$data = "{ \"notification\": { \"title\": \"".$fcm_data['title']."\", \"text\": \"".$fcm_data['message']."\", \"sound\": \"default\" }, \"time_to_live\": 60, \"data\" : {\"response\" : {\"status\" : \"success\", \"data\" : {\"event_id\" : \"".$fcm_data['id']."\", \"user_type\" : 2}}}, \"collapse_key\" : \"trip\", \"priority\":\"high\", \"to\" : \"".$fcm_token."\"}";
$ch = curl_init("https://fcm.googleapis.com/fcm/send");
$header = array('Content-Type: application/json', 'Authorization: key='.$key);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$out = curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
}
function recommend($data) { function recommend($data) {
try { try {
$locCond = ''; $locCond = '';
......
...@@ -168,13 +168,13 @@ class Organizer_model extends CI_Model { ...@@ -168,13 +168,13 @@ class Organizer_model extends CI_Model {
} else if($postData['layout_type'] == 2) { } else if($postData['layout_type'] == 2) {
$postData['seat_pricing'] = $postData['layout']; $postData['seat_pricing'] = $postData['layout'];
} }
$eventData = array('venue_id'=>(!empty($postData['venue_id']))?$postData['venue_id']:'', $eventData = array('venue_id'=>(isset($postData['venue_id']) && !empty($postData['venue_id']))?$postData['venue_id']:'',
'category_id'=>(!empty($postData['category_id']))?$postData['category_id']:'', 'category_id'=>(isset($postData['category_id']) && !empty($postData['category_id']))?$postData['category_id']:'',
'provider_id'=>(!empty($postData['organiser_id']))?$postData['organiser_id']:'', 'provider_id'=>(isset($postData['organiser_id']) && !empty($postData['organiser_id']))?$postData['organiser_id']:'',
'max_booking'=>(!empty($postData['maximum_seat_booking']))?$postData['maximum_seat_booking']:'', 'max_booking'=>(isset($postData['maximum_seat_booking']) && !empty($postData['maximum_seat_booking']))?$postData['maximum_seat_booking']:'',
'has_payment'=>(!empty($postData['payment_mode']))?$postData['payment_mode']:'', 'has_payment'=>(isset($postData['payment_mode']))?$postData['payment_mode']:'',
'seat_pricing'=>(!empty($postData['seat_pricing']))?json_encode($postData['seat_pricing']):'', 'seat_pricing'=>(isset($postData['seat_pricing']) && !empty($postData['seat_pricing']))?json_encode($postData['seat_pricing']):'',
'custom_seat_layout'=>(!empty($postData['custom_seat_layout']))?json_encode($postData['custom_seat_layout']):'', 'custom_seat_layout'=>(isset($postData['custom_seat_layout']) && !empty($postData['custom_seat_layout']))?json_encode($postData['custom_seat_layout']):'',
'approve_booking'=>$postData['approve_booking'], 'approve_booking'=>$postData['approve_booking'],
'status'=>3); 'status'=>3);
$evtName = (!empty($postData['event_name']))?$postData['event_name']:''; $evtName = (!empty($postData['event_name']))?$postData['event_name']:'';
......
...@@ -1163,9 +1163,10 @@ class Webservice_model extends CI_Model { ...@@ -1163,9 +1163,10 @@ class Webservice_model extends CI_Model {
$bookId = $post_data['bookId']; $bookId = $post_data['bookId'];
$lang = $countryData['language_code']; $lang = $countryData['language_code'];
$sql = "SELECT TEVT.event_name,CUST.name,CUST.email,CUST.phone, $sql = "SELECT TEVT.event_name,CUST.name,CUST.email,CUST.phone,
CONCAT(EDATE.date,' ',EDATE.time) AS show_time CONCAT(EDATE.date,' ',EDATE.time) AS show_time,PDR.fcm_token
FROM booking AS BK FROM booking AS BK
INNER JOIN events AS EVT ON (EVT.event_id=BK.event_id) INNER JOIN events AS EVT ON (EVT.event_id=BK.event_id)
INNER JOIN provider AS PDR ON (EVT.provider_id=PDR.provider_id)
INNER JOIN translator_event AS TEVT ON (TEVT.event_id=EVT.event_id) INNER JOIN translator_event AS TEVT ON (TEVT.event_id=EVT.event_id)
INNER JOIN customer AS CUST ON (CUST.customer_id=BK.customer_id) INNER JOIN customer AS CUST ON (CUST.customer_id=BK.customer_id)
INNER JOIN event_date_time AS EDATE ON (EDATE.id=BK.event_date_id) INNER JOIN event_date_time AS EDATE ON (EDATE.id=BK.event_date_id)
...@@ -1209,6 +1210,12 @@ class Webservice_model extends CI_Model { ...@@ -1209,6 +1210,12 @@ class Webservice_model extends CI_Model {
$this->sendSMS($phone,$msg); $this->sendSMS($phone,$msg);
} }
} }
if($post_data['status'] == 6){
$userData = array('id'=>$post_data['event_id'],
'title'=>'New Booking',
'message'=>'New Booking is There For Approval');
$this->push_sent_cancel($bkData['fcm_token'],$userData);
}
} }
} else { } else {
$res = array('status'=>0,'message'=>'Seat booking failed','code'=>'ER37'); $res = array('status'=>0,'message'=>'Seat booking failed','code'=>'ER37');
...@@ -1226,6 +1233,24 @@ class Webservice_model extends CI_Model { ...@@ -1226,6 +1233,24 @@ class Webservice_model extends CI_Model {
return 'https://www.barcodefaq.com/wp-content/uploads/2018/08/gs1-qrcode-fnc1.png'; return 'https://www.barcodefaq.com/wp-content/uploads/2018/08/gs1-qrcode-fnc1.png';
} }
public function push_sent_cancel($fcm_token='', $fcm_data=array()) {
$settings = getSettings();
$key = $settings['app_id'];
if(empty($key) || empty($fcm_token) || empty($fcm_data)){
return;
}
$data = "{ \"notification\": { \"title\": \"".$fcm_data['title']."\", \"text\": \"".$fcm_data['message']."\", \"sound\": \"default\" }, \"time_to_live\": 60, \"data\" : {\"response\" : {\"status\" : \"success\", \"data\" : {\"event_id\" : \"".$fcm_data['id']."\", \"user_type\" : 2}}}, \"collapse_key\" : \"trip\", \"priority\":\"high\", \"to\" : \"".$fcm_token."\"}";
$ch = curl_init("https://fcm.googleapis.com/fcm/send");
$header = array('Content-Type: application/json', 'Authorization: key='.$key);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$out = curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
}
function cancel($data) { function cancel($data) {
try { try {
$user_id = $this->auth_token_get($data['auth_token']); $user_id = $this->auth_token_get($data['auth_token']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment