Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcarfixers
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobin
dcarfixers
Commits
ecd11ef5
Commit
ecd11ef5
authored
5 years ago
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push notification code
parent
3596d5a2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
2 deletions
+52
-2
Webservices.php
application/controllers/Webservices.php
+29
-0
Webservice_model.php
application/models/Webservice_model.php
+19
-2
viewSettings.php
application/views/Settings/viewSettings.php
+4
-0
No files found.
application/controllers/Webservices.php
View file @
ecd11ef5
...
@@ -1430,6 +1430,12 @@
...
@@ -1430,6 +1430,12 @@
}
}
send_mail
(
$subject
,
$email_id
,
$message
);
send_mail
(
$subject
,
$email_id
,
$message
);
}
}
$fcm_data
=
$this
->
Webservice_model
->
getfcmData
(
$ref
,
$mobile
);
if
(
$fcm_data
[
'status'
]
==
"success"
){
$fcm_data
[
'title'
]
=
"CarFixxers"
;
$fcm_data
[
'message'
]
=
"Mechanic Booking"
;
$this
->
push_sent_cancel
(
$fcm_data
[
'data'
]);
}
if
(
$mobile
==
'1'
){
if
(
$mobile
==
'1'
){
redirect
(
'Webservices/mobPaySuccess'
);
redirect
(
'Webservices/mobPaySuccess'
);
}
else
{
}
else
{
...
@@ -1443,6 +1449,29 @@
...
@@ -1443,6 +1449,29 @@
}
}
}
}
}
}
public
function
push_sent_cancel
(
$fcm_data
=
array
())
{
$settings
=
getSettings
();
$key
=
$settings
[
'app_id'
];
if
(
empty
(
$key
)
||
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
\"
: {\"
booking_id
\
" :
\"
"
.
$fcm_data
[
'booking_id'
]
.
"
\"
,
\"
type
\"
:
\"
"
.
$fcm_data
[
'service_type'
]
.
"
\"
}}},
\"
collapse_key
\"
:
\"
trip
\"
,
\"
priority
\"
:
\"
high
\"
,
\"
to
\"
:
\"
"
.
$fcm_data
[
'device_id'
]
.
"
\"
}"
;
$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
);
}
//Search Products
//Search Products
public
function
productSearch
(){
public
function
productSearch
(){
header
(
'Content-type:application/json'
);
header
(
'Content-type:application/json'
);
...
...
This diff is collapsed.
Click to expand it.
application/models/Webservice_model.php
View file @
ecd11ef5
...
@@ -1525,8 +1525,8 @@ class Webservice_model extends CI_Model {
...
@@ -1525,8 +1525,8 @@ class Webservice_model extends CI_Model {
if
(
$start
!=
0
||
$per_page
!=
0
){
if
(
$start
!=
0
||
$per_page
!=
0
){
$this
->
db
->
limit
(
$per_page
,
$start
);
$this
->
db
->
limit
(
$per_page
,
$start
);
}
}
$review
=
$this
->
db
->
get_where
(
'mechanic_rating'
,
array
(
'mechanic_id'
=>
$postData
[
'mechanic_id'
]));
$review
=
$this
->
db
->
get_where
(
'mechanic_rating'
,
array
(
'mechanic_id'
=>
$postData
[
'mechanic_id'
]
,
'status'
=>
'1'
));
if
(
!
empty
(
$
service
)
&&
!
empty
(
$reviewData
=
$review
->
result_array
())){
if
(
!
empty
(
$
review
)
&&
!
empty
(
$reviewData
=
$review
->
result_array
())){
foreach
(
$reviewData
as
$key
=>
$value
)
{
foreach
(
$reviewData
as
$key
=>
$value
)
{
$reviewData
[
$key
][
'rate'
]
=
(
float
)
$value
[
'rate'
];
$reviewData
[
$key
][
'rate'
]
=
(
float
)
$value
[
'rate'
];
}
}
...
@@ -1536,5 +1536,22 @@ class Webservice_model extends CI_Model {
...
@@ -1536,5 +1536,22 @@ class Webservice_model extends CI_Model {
}
}
return
$respArr
;
return
$respArr
;
}
}
public
function
getfcmData
(
$transId
,
$mobile
){
$respArr
=
array
(
'status'
=>
'error'
);
if
(
$mobile
==
'1'
){
$this
->
db
->
join
(
"mechanic_booking"
,
"mechanic_booking.booking_id = bookings.booking_id"
);
}
else
{
$this
->
db
->
join
(
"mechanic_booking"
,
"mechanic_booking.booking_id = bookings.booking_id AND mechanic_booking.status='1'"
);
}
$this
->
db
->
select
(
'bookings.service_type,bookings.booking_id,mechanic.device_id'
);
$this
->
db
->
join
(
'bookings'
,
'bookings.booking_id = transaction.booking_id'
);
$result
=
$this
->
db
->
get_where
(
'transaction'
,
array
(
'id'
=>
$transId
))
->
row_array
();
if
(
$result
){
$respArr
[
'status'
]
=
"success"
;
$respArr
[
'data'
]
=
$result
;
}
return
$respArr
;
}
}
}
?>
?>
This diff is collapsed.
Click to expand it.
application/views/Settings/viewSettings.php
View file @
ecd11ef5
...
@@ -95,6 +95,10 @@
...
@@ -95,6 +95,10 @@
<label>
Web Url
</label>
<label>
Web Url
</label>
<input
type=
"text"
name=
"web_url"
class=
"form-control required"
placeholder=
"Enter Web Url"
value=
"
<?=
$data
[
'web_url'
]
?>
"
>
<input
type=
"text"
name=
"web_url"
class=
"form-control required"
placeholder=
"Enter Web Url"
value=
"
<?=
$data
[
'web_url'
]
?>
"
>
</div>
</div>
<div
class=
"form-group col-xs-3"
>
<label>
App Id
</label>
<input
type=
"text"
name=
"app_id"
class=
"form-control required"
placeholder=
"Enter App Id"
value=
"
<?=
$data
[
'app_id'
]
?>
"
>
</div>
</div>
</div>
</div>
</div>
<div
class=
"box-footer"
style=
"padding-left:46%"
>
<div
class=
"box-footer"
style=
"padding-left:46%"
>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment