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
9c80a1a5
Commit
9c80a1a5
authored
Feb 07, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove booking
parent
fa098ca8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
10 deletions
+100
-10
Webservices.php
application/controllers/Webservices.php
+52
-9
Webservice_model.php
application/models/Webservice_model.php
+48
-1
No files found.
application/controllers/Webservices.php
View file @
9c80a1a5
...
...
@@ -663,7 +663,7 @@
$headers
=
apache_request_headers
();
if
(
!
isset
(
$headers
[
'Auth'
])
||
empty
(
$headers
[
'Auth'
])){
$respArr
[
'status'
]
=
'
0
'
;
$respArr
[
'status'
]
=
'
error
'
;
$respArr
[
'message'
]
=
'Authtoken is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
...
...
@@ -685,7 +685,7 @@
$postData
=
json_decode
(
$post
,
true
);
if
(
!
isset
(
$headers
[
'Auth'
])
||
empty
(
$headers
[
'Auth'
])){
$respArr
[
'status'
]
=
'
0
'
;
$respArr
[
'status'
]
=
'
error
'
;
$respArr
[
'message'
]
=
'Authtoken is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
...
...
@@ -754,7 +754,7 @@
$postData
=
$_GET
;
if
(
!
isset
(
$headers
[
'Auth'
])
||
empty
(
$headers
[
'Auth'
])){
$respArr
[
'status'
]
=
'
0
'
;
$respArr
[
'status'
]
=
'
error
'
;
$respArr
[
'message'
]
=
'Authtoken is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
...
...
@@ -831,7 +831,7 @@
$postData
=
json_decode
(
$post
,
true
);
if
(
!
isset
(
$headers
[
'Auth'
])
||
empty
(
$headers
[
'Auth'
])){
$respArr
[
'status'
]
=
'
0
'
;
$respArr
[
'status'
]
=
'
error
'
;
$respArr
[
'message'
]
=
'Authtoken is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
...
...
@@ -879,7 +879,7 @@
$postData
=
$_GET
;
if
(
!
isset
(
$headers
[
'Auth'
])
||
empty
(
$headers
[
'Auth'
])){
$respArr
[
'status'
]
=
'
0
'
;
$respArr
[
'status'
]
=
'
error
'
;
$respArr
[
'message'
]
=
'Authtoken is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
...
...
@@ -960,7 +960,7 @@
$postData
=
json_decode
(
$post
,
true
);
if
(
!
isset
(
$headers
[
'Auth'
])
||
empty
(
$headers
[
'Auth'
])){
$respArr
[
'status'
]
=
'
0
'
;
$respArr
[
'status'
]
=
'
error
'
;
$respArr
[
'message'
]
=
'Authtoken is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
...
...
@@ -1017,7 +1017,7 @@
$postData
=
json_decode
(
$post
,
true
);
if
(
!
isset
(
$headers
[
'Auth'
])
||
empty
(
$headers
[
'Auth'
])){
$respArr
[
'status'
]
=
'
0
'
;
$respArr
[
'status'
]
=
'
error
'
;
$respArr
[
'message'
]
=
'Authtoken is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
...
...
@@ -1038,7 +1038,7 @@
$postData
=
$_GET
;
if
(
!
isset
(
$headers
[
'Auth'
])
||
empty
(
$headers
[
'Auth'
])){
$respArr
[
'status'
]
=
'
0
'
;
$respArr
[
'status'
]
=
'
error
'
;
$respArr
[
'message'
]
=
'Authtoken is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
...
...
@@ -1134,7 +1134,7 @@
$postData
=
$_POST
;
if
(
!
isset
(
$headers
[
'Auth'
])
||
empty
(
$headers
[
'Auth'
])){
$respArr
[
'status'
]
=
'
0
'
;
$respArr
[
'status'
]
=
'
error
'
;
$respArr
[
'message'
]
=
'Authtoken is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
...
...
@@ -1207,6 +1207,49 @@
$addServiceDetails
=
$this
->
Webservice_model
->
add_service_details
(
$postData
);
echo
json_encode
(
$addServiceDetails
);
exit
();
}
public
function
remove_booking
(){
header
(
'Content-type:application/json'
);
$headers
=
apache_request_headers
();
$post
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$post
,
true
);
if
(
!
isset
(
$headers
[
'Auth'
])
||
empty
(
$headers
[
'Auth'
])){
$respArr
[
'status'
]
=
'error'
;
$respArr
[
'message'
]
=
'Authtoken is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
$authRes
=
$this
->
Webservice_model
->
get_customer_authtoken
(
$headers
[
'Auth'
]);
if
(
$authRes
[
'status'
]
==
'error'
){
echo
json_encode
(
$authRes
);
exit
;
}
$removed
=
$this
->
Webservice_model
->
remove_booking
(
$postData
);
echo
json_encode
(
$removed
);
}
public
function
get_service
(){
header
(
'Content-type:application/json'
);
$headers
=
apache_request_headers
();
$post
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$post
,
true
);
if
(
!
isset
(
$headers
[
'Auth'
])
||
empty
(
$headers
[
'Auth'
])){
$respArr
[
'status'
]
=
'error'
;
$respArr
[
'message'
]
=
'Authtoken is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
$authRes
=
$this
->
Webservice_model
->
get_customer_authtoken
(
$headers
[
'Auth'
]);
if
(
$authRes
[
'status'
]
==
'error'
){
echo
json_encode
(
$authRes
);
exit
;
}
$getServices
=
$this
->
Webservice_model
->
get_service
(
$postData
);
echo
json_encode
(
$getServices
);
exit
;
}
}
?>
application/models/Webservice_model.php
View file @
9c80a1a5
...
...
@@ -352,6 +352,7 @@ class Webservice_model extends CI_Model {
}
else
{
$limt
=
""
;
}
$sql
=
"SELECT AU.display_name,AU.profile_image,ME.*,MS.shop_name,MS.address AS shop_address,
MS.phone AS shop_phone,MS.email_id AS shop_email_id,
3956*2*ASIN(SQRT(POWER(SIN((
$current_lat
-ME.location_lat)*pi()/180/2),2)+
...
...
@@ -423,7 +424,7 @@ class Webservice_model extends CI_Model {
}
public
function
add_service_details
(
$postData
){
$respArr
=
array
(
'status'
=>
'error'
,
'message'
=>
'Something Went Wrong
.
'
);
$respArr
=
array
(
'status'
=>
'error'
,
'message'
=>
'Something Went Wrong'
);
if
(
empty
(
$postData
[
'booking_id'
])){
$respArr
[
'message'
]
=
'Booking Id is Required'
;
...
...
@@ -442,6 +443,52 @@ class Webservice_model extends CI_Model {
return
$respArr
;
}
}
public
function
remove_booking
(
$postData
=
array
()){
$respArr
=
array
(
'status'
=>
'error'
,
'message'
=>
'Something Went Wrong..!'
);
if
(
empty
(
$postData
[
'booking_id'
])){
$respArr
[
'message'
]
=
'Booking Id is Required'
;
return
$respArr
;
}
else
if
(
empty
(
$postData
[
'service_id'
])){
$respArr
[
'message'
]
=
'Service Id is Required'
;
return
$respArr
;
}
$booked_data
=
$this
->
db
->
get_where
(
'bookings'
,
array
(
'booking_id'
=>
$postData
[
'booking_id'
]));
if
(
!
empty
(
$booked_data
)
&&
!
empty
(
$booked_data
=
$booked_data
->
row_array
())){
$issues_selected
=
json_decode
(
$booked_data
[
'issues_selected'
]);
foreach
(
$issues_selected
as
$key
=>
$value
){
if
(
$value
->
sub_issue_id
==
$postData
[
'service_id'
]){
unset
(
$issues_selected
[
$key
]);
}
}
$issues_selected
=
array_values
(
$issues_selected
);
if
(
$this
->
db
->
update
(
'bookings'
,
array
(
'issues_selected'
=>
json_encode
(
$issues_selected
)),
array
(
'booking_id'
=>
$postData
[
'booking_id'
]))){
$respArr
[
'status'
]
=
'success'
;
$respArr
[
'message'
]
=
'success'
;
}
return
$respArr
;
}
}
public
function
get_service
(
$postData
=
array
()){
$respArr
=
array
(
'status'
=>
'error'
,
'message'
=>
'Something went Wrong.. Try Again'
);
if
(
empty
(
$postData
[
'booking_id'
])){
$respArr
[
'message'
]
=
'Booking Id is Required'
;
return
$respArr
;
}
$booked_data
=
$this
->
db
->
get_where
(
'bookings'
,
array
(
'booking_id'
=>
$postData
[
'booking_id'
]));
if
(
!
empty
(
$booked_data
)
&&
!
empty
(
$booked_data
=
$booked_data
->
row_array
())){
$respArr
[
'status'
]
=
'success'
;
$respArr
[
'message'
]
=
'success'
;
$respArr
[
'data'
][
'services'
]
=
json_decode
(
$booked_data
[
'issues_selected'
]);
}
return
$respArr
;
}
}
?>
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