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
a4804b4c
Commit
a4804b4c
authored
6 years ago
by
Jansa Jose
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'dev_production'
Master See merge request
!60
parents
ab2055e8
3fe72c29
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
129 additions
and
8 deletions
+129
-8
Webservices.php
application/controllers/Webservices.php
+93
-0
Webservice_model.php
application/models/Webservice_model.php
+36
-8
No files found.
application/controllers/Webservices.php
View file @
a4804b4c
...
@@ -2171,6 +2171,14 @@
...
@@ -2171,6 +2171,14 @@
$postData
[
'customer_id'
]
=
$authRes
[
'data'
][
'customer_id'
];
$postData
[
'customer_id'
]
=
$authRes
[
'data'
][
'customer_id'
];
$prd_data
=
$this
->
Webservice_model
->
SingleProductSearch
(
$postData
);
if
(
$prd_data
[
'status'
]
==
'error'
){
$respArr
[
'status'
]
=
'error'
;
$respArr
[
'message'
]
=
'Amount is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
$postData
[
'amount'
]
=
$prd_data
[
'data'
]
->
amount
*
$postData
[
'quantity'
];
$result
=
$this
->
Webservice_model
->
addToCart
(
$postData
);
$result
=
$this
->
Webservice_model
->
addToCart
(
$postData
);
echo
json_encode
(
$result
);
exit
;
echo
json_encode
(
$result
);
exit
;
}
}
...
@@ -2499,6 +2507,25 @@
...
@@ -2499,6 +2507,25 @@
echo
json_encode
(
$result
);
exit
;
echo
json_encode
(
$result
);
exit
;
}
}
public
function
get_vehicle_brand
(){
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_model
->
get_customer_authtoken
(
$headers
[
'Auth'
]);
if
(
$authRes
[
'status'
]
==
'error'
){
echo
json_encode
(
$authRes
);
exit
;
}
$result
=
$this
->
Webservice_model
->
getVehicleBrand
();
echo
json_encode
(
$result
);
exit
;
}
public
function
getVehicleModel
(){
public
function
getVehicleModel
(){
header
(
'Content-type:application/json'
);
header
(
'Content-type:application/json'
);
$headers
=
apache_request_headers
();
$headers
=
apache_request_headers
();
...
@@ -2509,6 +2536,72 @@
...
@@ -2509,6 +2536,72 @@
$result
=
$this
->
Webservice_model
->
getVehicleModel
(
$postData
);
$result
=
$this
->
Webservice_model
->
getVehicleModel
(
$postData
);
echo
json_encode
(
$result
);
exit
;
echo
json_encode
(
$result
);
exit
;
}
}
public
function
get_vehicle_model
(){
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_model
->
get_customer_authtoken
(
$headers
[
'Auth'
]);
if
(
$authRes
[
'status'
]
==
'error'
){
echo
json_encode
(
$authRes
);
exit
;
}
$post
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$post
,
true
);
$result
=
$this
->
Webservice_model
->
getVehicleModel
(
$postData
);
echo
json_encode
(
$result
);
exit
;
}
public
function
get_userAddress_by_id
(){
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_model
->
get_customer_authtoken
(
$headers
[
'Auth'
]);
if
(
$authRes
[
'status'
]
==
'error'
){
echo
json_encode
(
$authRes
);
exit
;
}
$postData
=
$_GET
;
$postData
[
'customer_id'
]
=
$authRes
[
'data'
][
'customer_id'
];
$result
=
$this
->
Webservice_model
->
getUserAddressById
(
$postData
);
echo
json_encode
(
$result
);
exit
;
}
public
function
update_address
(){
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_model
->
get_customer_authtoken
(
$headers
[
'Auth'
]);
if
(
$authRes
[
'status'
]
==
'error'
){
echo
json_encode
(
$authRes
);
exit
;
}
$post
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$post
,
true
);
$result
=
$this
->
Webservice_model
->
update_user_address
(
$postData
);
echo
json_encode
(
$result
);
exit
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
application/models/Webservice_model.php
View file @
a4804b4c
...
@@ -621,18 +621,31 @@ class Webservice_model extends CI_Model {
...
@@ -621,18 +621,31 @@ class Webservice_model extends CI_Model {
$where
.=
" PRD.amount < "
.
$postData
[
'maxPrice'
]
.
" AND "
;
$where
.=
" PRD.amount < "
.
$postData
[
'maxPrice'
]
.
" AND "
;
}
}
if
(
isset
(
$postData
[
'year'
])
&&
$postData
[
'year'
]
!=
''
){
$where
.=
" CRD.year = "
.
$postData
[
'year'
]
.
" AND "
;
}
if
(
isset
(
$postData
[
'maker'
])
&&
$postData
[
'maker'
]
!=
''
){
$where
.=
" VEHM.veh_brand_id = "
.
$postData
[
'maker'
]
.
" AND "
;
}
if
(
isset
(
$postData
[
'model'
])
&&
$postData
[
'model'
]
!=
''
){
$where
.=
" VEHM.veh_modal_id = "
.
$postData
[
'model'
]
.
" AND "
;
}
$result
=
$this
->
db
->
query
(
"SELECT ROUND(AVG(REV.rating),2) AS rating,
$result
=
$this
->
db
->
query
(
"SELECT ROUND(AVG(REV.rating),2) AS rating,
COUNT(REV.id) AS count,PRD.*,PI.image
COUNT(REV.id) AS count,PRD.*,PI.image
FROM products AS PRD
FROM products AS PRD
LEFT JOIN
product_images AS PI ON
LEFT JOIN
cardetails AS CRD ON (PRD.cardetail_id=CRD.id)
(PI.id=(SELECT MIN(id)
LEFT JOIN product_rating AS REV ON (REV.product_id=PRD.product_id)
FROM product_images
LEFT JOIN vehicles_model AS VEHM ON (VEHM.veh_modal_id=CRD.veh_modal_id)
WHERE product_id= PRD.product_id AND
LEFT JOIN product_images AS PI ON (PI.id=
PRD.status='1'))
(SELECT MIN(id) FROM product_images
LEFT JOIN product_rating AS REV ON REV.product_id = PRD.product_id
WHERE product_id=PRD.product_id AND PRD.status='1'))
WHERE
$where
PRD.status='1'
WHERE
$where
PRD.status='1'
GROUP BY PRD.product_id,PI.product_id
GROUP BY PRD.product_id,PI.product_id
$lmt
"
);
$lmt
"
);
if
(
!
empty
(
$result
)
&&
$result
->
num_rows
()
>
0
){
if
(
!
empty
(
$result
)
&&
$result
->
num_rows
()
>
0
){
$result
=
$result
->
result_array
();
$result
=
$result
->
result_array
();
foreach
(
$result
as
$key
=>
$value
)
{
foreach
(
$result
as
$key
=>
$value
)
{
...
@@ -809,6 +822,21 @@ class Webservice_model extends CI_Model {
...
@@ -809,6 +822,21 @@ class Webservice_model extends CI_Model {
return
$respArr
;
return
$respArr
;
}
}
public
function
update_user_address
(
$postData
){
$respArr
=
array
(
'status'
=>
'error'
);
if
(
empty
(
$postData
[
'id'
])){
$respArr
[
'message'
]
=
'Address Id is required'
;
return
$respArr
;
}
if
(
$this
->
db
->
update
(
'customer_address'
,
$postData
,
array
(
'id'
=>
$postData
[
'id'
]))){
$respArr
[
'status'
]
=
'success'
;
$respArr
[
'message'
]
=
'Address Updated Successfully'
;
}
return
$respArr
;
}
public
function
initOrderBooking
(
$postData
=
array
()){
public
function
initOrderBooking
(
$postData
=
array
()){
$respArr
=
array
(
'status'
=>
'error'
);
$respArr
=
array
(
'status'
=>
'error'
);
if
(
empty
(
$postData
[
'data'
])){
if
(
empty
(
$postData
[
'data'
])){
...
...
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