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
09172077
Commit
09172077
authored
Aug 29, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add location for mechanic
parent
19016293
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
Webservices_mechanic.php
application/controllers/Webservices_mechanic.php
+29
-0
Webservice_mechanic_model.php
application/models/Webservice_mechanic_model.php
+12
-0
No files found.
application/controllers/Webservices_mechanic.php
View file @
09172077
...
...
@@ -286,5 +286,34 @@
$respArr
=
$this
->
Webservice_mechanic_model
->
update_profile_status
(
$postData
);
echo
json_encode
(
$respArr
);
exit
;
}
public
function
add_location
(){
header
(
'Content-type: application/json'
);
$headers
=
apache_request_headers
();
if
(
!
isset
(
$headers
[
'auth'
])
||
empty
(
$headers
[
'auth'
])){
$respArr
[
'status'
]
=
'error'
;
$respArr
[
'message'
]
=
'Authtoken is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
$authRes
=
$this
->
Webservice_mechanic_model
->
get_mechanic_authtoken
(
$headers
[
'auth'
]);
if
(
$authRes
[
'status'
]
==
'error'
){
echo
json_encode
(
$respArr
);
exit
;
}
$post
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$post
,
true
);
if
(
!
isset
(
$postData
[
'lat'
])
&&
empty
(
$postData
[
'lat'
])){
$respArr
[
'message'
]
=
"Latitude is Required"
;
echo
json_encode
(
$respArr
)
;
exit
;
}
else
if
(
!
isset
(
$postData
[
'lng'
])
&&
empty
(
$postData
[
'lng'
])){
$respArr
[
'message'
]
=
"Longitude is Required"
;
echo
json_encode
(
$respArr
)
;
exit
;
}
$postData
[
'mechanic_id'
]
=
$authRes
[
'data'
][
'mechanic_id'
];
$respArr
=
$this
->
Webservice_mechanic_model
->
add_location
(
$postData
);
echo
json_encode
(
$respArr
);
exit
;
}
}
?>
application/models/Webservice_mechanic_model.php
View file @
09172077
...
...
@@ -211,5 +211,17 @@ public function update_profile_status($postData = array()){
}
return
$respArr
;
}
public
function
add_location
(
$postData
){
$respArr
=
array
(
'status'
=>
'error'
);
if
(
empty
(
$postData
)){
return
$respArr
;
}
if
(
$this
->
db
->
update
(
'mechanic'
,
array
(
'location_lat'
=>
$postData
[
'location_lat'
],
'location_lng'
=>
$postData
[
'location_lng'
]),
array
(
'mechanic_id'
=>
$postData
[
'mechanic_id'
]))){
$respArr
[
'status'
]
=
"success"
;
$respArr
[
'message'
]
=
"Location Updated Successfully"
;
}
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