Commit 9c5d327b by Tobin

t : push notification

parent 06060c72
...@@ -125,7 +125,7 @@ class Notification extends CI_Controller { ...@@ -125,7 +125,7 @@ class Notification extends CI_Controller {
'title'=>$event_data->event_name_EN, 'title'=>$event_data->event_name_EN,
'param'=>'event_id', 'param'=>'event_id',
'message'=>$message); 'message'=>$message);
push_sent_cancel($user['fcm_token'],$userData); push_sent_cancel(1,$user['fcm_token'],$userData);
} }
$flashMsg['class'] = 'success'; $flashMsg['class'] = 'success';
...@@ -156,7 +156,7 @@ class Notification extends CI_Controller { ...@@ -156,7 +156,7 @@ class Notification extends CI_Controller {
'param'=>'booking_id', 'param'=>'booking_id',
'title'=>$bData['event_name_en'], 'title'=>$bData['event_name_en'],
'message'=>'Booking Remainder'); 'message'=>'Booking Remainder');
push_sent_cancel($bData['fcm_token'],$userData); push_sent_cancel(1,$bData['fcm_token'],$userData);
} }
} }
} }
......
...@@ -397,9 +397,9 @@ ...@@ -397,9 +397,9 @@
return $langArr; return $langArr;
} }
function push_sent_cancel($fcm_token='', $fcm_data=array()) { function push_sent_cancel($app='1',$fcm_token='', $fcm_data=array()) {
$settings = getSettings(); $settings = getSettings();
$key = $settings['org_app_id']; $key = ($app=='1')?$settings['app_id']:$settings['org_app_id'];
if(empty($key) || empty($fcm_token) || empty($fcm_data)){ if(empty($key) || empty($fcm_token) || empty($fcm_data)){
return; return;
} }
......
...@@ -705,7 +705,7 @@ class Api_model extends CI_Model { ...@@ -705,7 +705,7 @@ class Api_model extends CI_Model {
'title'=>'New Booking', 'title'=>'New Booking',
'param'=>'booking_id', 'param'=>'booking_id',
'message'=>'New Booking is There For Approval'); 'message'=>'New Booking is There For Approval');
push_sent_cancel($bkData['fcm_token'],$userData); push_sent_cancel(2,$bkData['fcm_token'],$userData);
} }
} }
} else { } else {
...@@ -1423,7 +1423,7 @@ class Api_model extends CI_Model { ...@@ -1423,7 +1423,7 @@ class Api_model extends CI_Model {
'title'=>'New Booking', 'title'=>'New Booking',
'param'=>'booking_id', 'param'=>'booking_id',
'message'=>'New Booking is There For Approval'); 'message'=>'New Booking is There For Approval');
push_sent_cancel($bkData['fcm_token'],$userData); push_sent_cancel(2,$bkData['fcm_token'],$userData);
} }
} }
$this->db->update('booking',array('status'=>$bokStatus),array('bookId'=>$book_id)); $this->db->update('booking',array('status'=>$bokStatus),array('bookId'=>$book_id));
......
...@@ -1100,7 +1100,7 @@ class Organizer_model extends CI_Model { ...@@ -1100,7 +1100,7 @@ class Organizer_model extends CI_Model {
'param'=>'booking_id', 'param'=>'booking_id',
'title'=>'Booking Approved', 'title'=>'Booking Approved',
'message'=>'Your Booking is Approved by the Event Provider'); 'message'=>'Your Booking is Approved by the Event Provider');
push_sent_cancel($bData['fcm_token'],$userData); push_sent_cancel(2,$bData['fcm_token'],$userData);
$res = array('status'=>1,'message'=>'Booking Accepted Successfully'); $res = array('status'=>1,'message'=>'Booking Accepted Successfully');
}catch(Exception $e){ }catch(Exception $e){
$res = array('status'=>0,'message'=>'Ohh No!! Something Went South','code'=>'ER06'); $res = array('status'=>0,'message'=>'Ohh No!! Something Went South','code'=>'ER06');
......
...@@ -1215,7 +1215,7 @@ class Webservice_model extends CI_Model { ...@@ -1215,7 +1215,7 @@ class Webservice_model extends CI_Model {
'param'=>'booking_id', 'param'=>'booking_id',
'title'=>'New Booking', 'title'=>'New Booking',
'message'=>'New Booking is There For Approval'); 'message'=>'New Booking is There For Approval');
push_sent_cancel($bkData['fcm_token'],$userData); push_sent_cancel(2,$bkData['fcm_token'],$userData);
} }
} }
} else { } else {
...@@ -1914,7 +1914,7 @@ class Webservice_model extends CI_Model { ...@@ -1914,7 +1914,7 @@ class Webservice_model extends CI_Model {
$fcmData = array('id'=>$user_id,'param'=>'user_id', $fcmData = array('id'=>$user_id,'param'=>'user_id',
'title'=>'Accepted Chat Request', 'title'=>'Accepted Chat Request',
'message'=>$frmCustData['name'].' has Accepted Your Chat Request'); 'message'=>$frmCustData['name'].' has Accepted Your Chat Request');
push_sent_cancel($toCustData['fcm_token'],$fcmData); push_sent_cancel(1,$toCustData['fcm_token'],$fcmData);
} }
return ($status)?1:0; return ($status)?1:0;
} }
...@@ -1938,7 +1938,7 @@ class Webservice_model extends CI_Model { ...@@ -1938,7 +1938,7 @@ class Webservice_model extends CI_Model {
$fcmData = array('id'=>$toUser,'param'=>'user_id', $fcmData = array('id'=>$toUser,'param'=>'user_id',
'title'=>'New Chat Request', 'title'=>'New Chat Request',
'message'=>'You got a New Chat Request from '.$toCustData['name']); 'message'=>'You got a New Chat Request from '.$toCustData['name']);
push_sent_cancel($frmCustData['fcm_token'],$fcmData); push_sent_cancel(1,$frmCustData['fcm_token'],$fcmData);
} else if (!empty($result) && $result['type'] == '0'){ } else if (!empty($result) && $result['type'] == '0'){
$this->db->update('chats',array('type'=>'1'),array('chat_id'=>$result['chat_id'])); $this->db->update('chats',array('type'=>'1'),array('chat_id'=>$result['chat_id']));
} }
......
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