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
f7c980f4
Commit
f7c980f4
authored
Aug 05, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dc
parent
486d8dd4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
36 deletions
+88
-36
Webservices.php
Webservices.php
+0
-0
Webservices.php
application/controllers/Webservices.php
+0
-0
Webservices_mechanic.php
application/controllers/Webservices_mechanic.php
+0
-10
Webservice_model.php
application/models/Webservice_model.php
+88
-26
No files found.
Webservices.php
deleted
100644 → 0
View file @
486d8dd4
This diff is collapsed.
Click to expand it.
application/controllers/Webservices.php
View file @
f7c980f4
This diff is collapsed.
Click to expand it.
application/controllers/Webservices_mechanic.php
View file @
f7c980f4
...
@@ -23,16 +23,6 @@
...
@@ -23,16 +23,6 @@
$this
->
load
->
model
(
'Webservice_mechanic_model'
);
$this
->
load
->
model
(
'Webservice_mechanic_model'
);
$this
->
load
->
library
(
'form_validation'
);
$this
->
load
->
library
(
'form_validation'
);
$auth
=
''
;
$class
=
$this
->
router
->
fetch_class
();
$method
=
$this
->
router
->
fetch_method
();
if
(
$this
->
input
->
server
(
'REQUEST_METHOD'
)
==
'GET'
)
$postdata
=
json_encode
(
$_GET
);
else
if
(
$this
->
input
->
server
(
'REQUEST_METHOD'
)
==
'POST'
)
$postdata
=
file_get_contents
(
"php://input"
);
if
(
isset
(
apache_request_headers
()[
'Auth'
]))
{
$auth
=
apache_request_headers
()[
'Auth'
];
}
define
(
"PAYSTACK_SECRET_KEY"
,
"sk_test_36658e3260b1d1668b563e6d8268e46ad6da3273"
);
define
(
"PAYSTACK_SECRET_KEY"
,
"sk_test_36658e3260b1d1668b563e6d8268e46ad6da3273"
);
}
}
...
...
application/models/Webservice_model.php
View file @
f7c980f4
...
@@ -763,20 +763,26 @@ class Webservice_model extends CI_Model {
...
@@ -763,20 +763,26 @@ class Webservice_model extends CI_Model {
$where
.=
" PRD.amount < "
.
$postData
[
'maxPrice'
]
.
" AND "
;
$where
.=
" PRD.amount < "
.
$postData
[
'maxPrice'
]
.
" AND "
;
}
}
if
(
isset
(
$postData
[
'year'
])
&&
$postData
[
'year'
]
!=
''
){
if
(
isset
(
$postData
[
'year'
])
&&
$postData
[
'year'
]
!=
''
){
$where
.=
"
CRD
.year = "
.
$postData
[
'year'
]
.
" AND "
;
$where
.=
"
VEH
.year = "
.
$postData
[
'year'
]
.
" AND "
;
}
}
if
(
isset
(
$postData
[
'maker'
])
&&
$postData
[
'maker'
]
!=
''
){
if
(
isset
(
$postData
[
'maker'
])
&&
$postData
[
'maker'
]
!=
''
){
$where
.=
" VEH
M
.veh_brand_id = "
.
$postData
[
'maker'
]
.
" AND "
;
$where
.=
" VEH.veh_brand_id = "
.
$postData
[
'maker'
]
.
" AND "
;
}
}
if
(
isset
(
$postData
[
'model'
])
&&
$postData
[
'model'
]
!=
''
){
if
(
isset
(
$postData
[
'model'
])
&&
$postData
[
'model'
]
!=
''
){
$where
.=
" VEHM.veh_modal_id = "
.
$postData
[
'model'
]
.
" AND "
;
$where
.=
" VEH.model_id = "
.
$postData
[
'model'
]
.
" AND "
;
}
// if(isset($postData['modelName']) && $postData['modelName'] != ''){
// $where .= " VEHM.model_name = '".$postData['modelName']."' AND ";
// }
if
(
isset
(
$postData
[
'trim'
])
&&
$postData
[
'trim'
]
!=
''
){
$where
.=
" VEH.trim = '"
.
$postData
[
'trim'
]
.
"' 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"
.
$cartSel
.
"
COUNT(REV.id) AS count,PRD.*,PI.image"
.
$cartSel
.
"
FROM products AS PRD
FROM products AS PRD
LEFT JOIN product_cars AS CRD ON (PRD.product_id=CRD.product_id)
LEFT JOIN product_cars AS CRD ON (PRD.product_id=CRD.product_id)
LEFT JOIN product_rating AS REV ON (REV.product_id=PRD.product_id)
LEFT JOIN product_rating AS REV ON (REV.product_id=PRD.product_id)
LEFT JOIN vehicles
_model AS VEHM ON (VEHM.veh_modal_id=
CRD.veh_model_id)
LEFT JOIN vehicles
AS VEH ON (VEH.veh_id =
CRD.veh_model_id)
LEFT JOIN product_images AS PI ON (PI.id=
LEFT JOIN product_images AS PI ON (PI.id=
(SELECT MIN(id) FROM product_images
(SELECT MIN(id) FROM product_images
WHERE product_id=PRD.product_id AND PRD.status='1')) "
.
$cartJoin
.
"
WHERE product_id=PRD.product_id AND PRD.status='1')) "
.
$cartJoin
.
"
...
@@ -1001,7 +1007,6 @@ class Webservice_model extends CI_Model {
...
@@ -1001,7 +1007,6 @@ class Webservice_model extends CI_Model {
$respArr
[
'message'
]
=
'All Field is required'
;
$respArr
[
'message'
]
=
'All Field is required'
;
return
$respArr
;
return
$respArr
;
}
}
$this
->
db
->
delete
(
'cart'
,
array
(
'customer_id'
=>
$postData
[
'customer_id'
]));
$bulk_flag
=
0
;
$bulk_flag
=
0
;
$bulkUnqueId
=
''
;
$bulkUnqueId
=
''
;
if
((
$bulk_flag
=
count
(
$postData
[
'data'
]))
>
1
){
if
((
$bulk_flag
=
count
(
$postData
[
'data'
]))
>
1
){
...
@@ -1301,13 +1306,25 @@ class Webservice_model extends CI_Model {
...
@@ -1301,13 +1306,25 @@ class Webservice_model extends CI_Model {
return
$respArr
;
return
$respArr
;
}
}
public
function
removeCartPrdt
(
$
postData
){
public
function
removeCartPrdt
(
$
cart_id
){
$respArr
=
array
(
'status'
=>
'error'
);
$respArr
=
array
(
'status'
=>
'error'
);
if
(
empty
(
$
postData
[
'cart_id'
])
){
if
(
empty
(
$
cart_id
)
||
$cart_id
==
''
){
$respArr
[
'message'
]
=
"Cart Id is Required"
;
$respArr
[
'message'
]
=
"Cart Id is Required"
;
return
$respArr
;
return
$respArr
;
}
}
if
(
$this
->
db
->
delete
(
'cart'
,
array
(
'cart_id'
=>
$postData
[
'cart_id'
]))){
if
(
$this
->
db
->
delete
(
'cart'
,
array
(
'cart_id'
=>
$cart_id
))){
$respArr
[
'status'
]
=
"success"
;
}
return
$respArr
;
}
public
function
removeCartPrdtAPI
(
$customer_id
=
''
){
$respArr
=
array
(
'status'
=>
'error'
);
if
(
empty
(
$customer_id
)
||
$customer_id
==
''
){
$respArr
[
'message'
]
=
"Customer Id is Required"
;
return
$respArr
;
}
if
(
$this
->
db
->
delete
(
'cart'
,
array
(
'customer_id'
=>
$customer_id
))){
$respArr
[
'status'
]
=
"success"
;
$respArr
[
'status'
]
=
"success"
;
}
}
return
$respArr
;
return
$respArr
;
...
@@ -1363,10 +1380,15 @@ class Webservice_model extends CI_Model {
...
@@ -1363,10 +1380,15 @@ class Webservice_model extends CI_Model {
if
(
!
isset
(
$postData
[
'vehBrand_id'
])
&&
empty
(
$postData
[
'vehBrand_id'
])){
if
(
!
isset
(
$postData
[
'vehBrand_id'
])
&&
empty
(
$postData
[
'vehBrand_id'
])){
$respArr
[
'message'
]
=
'Vehicle Brand Id is Required'
;
$respArr
[
'message'
]
=
'Vehicle Brand Id is Required'
;
}
}
$this
->
db
->
select
(
"DISTINCT(model) as model,veh_modal_id,engine,trim"
);
if
(
!
isset
(
$postData
[
'vehiYear'
])
&&
empty
(
$postData
[
'vehiYear'
])){
$respArr
[
'message'
]
=
'Vehicle Year is Required'
;
}
$this
->
db
->
select
(
"DISTINCT(VEHM.model_name) as model,VEHM.veh_model_id,VEH.engine,VEH.trim"
);
$this
->
db
->
join
(
'vehicle_models AS VEHM'
,
'VEHM.veh_model_id = VEH.model_id'
);
$this
->
db
->
order_by
(
'model'
);
$this
->
db
->
order_by
(
'model'
);
$result
=
$this
->
db
->
get_where
(
'vehicles_model'
,
$result
=
$this
->
db
->
get_where
(
'vehicles AS VEH'
,
array
(
'veh_brand_id'
=>
$postData
[
'vehBrand_id'
],
'status'
=>
'1'
));
array
(
'VEH.veh_brand_id'
=>
$postData
[
'vehBrand_id'
],
'VEH.status'
=>
'1'
,
'VEH.year'
=>
$postData
[
'vehiYear'
]));
// pr($this->db->last_query());
if
(
empty
(
$result
)
||
empty
(
$result
=
$result
->
result
())){
if
(
empty
(
$result
)
||
empty
(
$result
=
$result
->
result
())){
$respArr
[
'status'
]
=
"error"
;
$respArr
[
'status'
]
=
"error"
;
return
$respArr
;
return
$respArr
;
...
@@ -1391,6 +1413,36 @@ class Webservice_model extends CI_Model {
...
@@ -1391,6 +1413,36 @@ class Webservice_model extends CI_Model {
return
$respArr
;
return
$respArr
;
}
}
public
function
getVehicleTrim
(
$postData
=
array
()){
$respArr
=
array
(
'status'
=>
'error'
);
if
(
!
isset
(
$postData
[
'vehBrand_id'
])
&&
empty
(
$postData
[
'vehBrand_id'
])){
$respArr
[
'message'
]
=
'Vehicle Brand Id is Required'
;
}
else
if
(
!
isset
(
$postData
[
'vehiYear'
])
&&
empty
(
$postData
[
'vehiYear'
])){
$respArr
[
'message'
]
=
'Vehicle Year is Required'
;
}
else
if
(
!
isset
(
$postData
[
'vehiModel'
])
&&
empty
(
$postData
[
'vehiModel'
])){
$respArr
[
'message'
]
=
'Vehicle Model is Required'
;
}
$this
->
db
->
select
(
"VEH.model_id,VEH.trim"
);
$this
->
db
->
join
(
'vehicle_models AS VEHM'
,
'VEHM.veh_model_id = VEH.model_id'
);
$result
=
$this
->
db
->
get_where
(
'vehicles as VEH'
,
array
(
'VEH.veh_brand_id'
=>
$postData
[
'vehBrand_id'
],
'VEH.status'
=>
'1'
,
'VEH.year'
=>
$postData
[
'vehiYear'
],
'VEH.model_id'
=>
$postData
[
'vehiModel'
]));
if
(
empty
(
$result
)
||
empty
(
$result
=
$result
->
result
())){
$respArr
[
'status'
]
=
"error"
;
return
$respArr
;
}
$trim
=
array
();
foreach
(
$result
AS
$key
=>
$value
)
{
if
(
empty
(
$value
->
trim
)){
unset
(
$result
[
$key
]);
}
}
$respArr
[
'data'
]
=
$result
;
$respArr
[
'status'
]
=
'success'
;
return
$respArr
;
}
public
function
socialLogin
(
$postData
=
array
()){
public
function
socialLogin
(
$postData
=
array
()){
$respArr
=
array
(
'status'
=>
'error'
);
$respArr
=
array
(
'status'
=>
'error'
);
if
(
empty
(
$postData
[
'data'
])){
if
(
empty
(
$postData
[
'data'
])){
...
@@ -1487,31 +1539,41 @@ class Webservice_model extends CI_Model {
...
@@ -1487,31 +1539,41 @@ class Webservice_model extends CI_Model {
return
$respArr
;
return
$respArr
;
}
}
$veh_data
=
json_decode
(
$carData
->
vehicle_data
);
$veh_data
=
json_decode
(
$carData
->
vehicle_data
);
$result
=
$this
->
db
->
query
(
"SELECT VEHM.veh_modal_id,VEHM.veh_brand_id
$result
=
$this
->
db
->
query
(
"SELECT VEH.model_id AS veh_modal_id,VEH.veh_brand_id,VEH.year,VEH.trim,
FROM vehicles_model AS VEHM
VEHM.model_name AS model
INNER JOIN vehicles_brand AS VEHB ON VEHB.veh_brand_id = VEHM.veh_brand_id
FROM vehicles AS VEH
INNER JOIN vehicles_brand AS VEHB ON VEHB.veh_brand_id = VEH.veh_brand_id
INNER JOIN vehicle_models AS VEHM ON VEHM.veh_model_id = VEH.model_id
WHERE VEHB.maker LIKE '
$veh_data->make
'
WHERE VEHB.maker LIKE '
$veh_data->make
'
AND VEHM.model LIKE '
$veh_data->model
'
AND VEHM.model_name LIKE '
$veh_data->model
'
AND VEHM.engine LIKE '
$veh_data->engine
'
AND VEH.year LIKE '
$veh_data->year
'
AND VEHM.trim LIKE '
$veh_data->trim
'"
AND VEH.engine LIKE '
$veh_data->engine
'
AND VEH.trim LIKE '
$veh_data->trim
'"
);
);
if
(
empty
(
$result
)
||
$result
->
num_rows
()
<=
0
){
if
(
empty
(
$result
)
||
$result
->
num_rows
()
<=
0
){
$result
=
$this
->
db
->
query
(
"SELECT VEHM.veh_modal_id,VEHM.veh_brand_id
$result
=
$this
->
db
->
query
(
"SELECT VEH.model_id AS veh_modal_id,VEH.veh_brand_id,VEH.year,VEH.trim,
FROM vehicles_model AS VEHM
VEHM.model_name AS model
INNER JOIN vehicles_brand AS VEHB ON VEHB.veh_brand_id = VEHM.veh_brand_id
FROM vehicles AS VEH
INNER JOIN vehicles_brand AS VEHB ON VEHB.veh_brand_id = VEH.veh_brand_id
INNER JOIN vehicle_models AS VEHM ON VEHM.veh_model_id = VEH.model_id
WHERE VEHB.maker LIKE '
$veh_data->make
'
WHERE VEHB.maker LIKE '
$veh_data->make
'
AND VEHM.model LIKE '
$veh_data->model
'
AND VEH.year LIKE '
$veh_data->year
'
AND VEHM.trim LIKE '
$veh_data->trim
'"
AND VEHM.model_name LIKE '
$veh_data->model
'
AND VEH.trim LIKE '
$veh_data->trim
'"
);
);
}
}
if
(
empty
(
$result
)
||
$result
->
num_rows
()
<=
0
){
if
(
empty
(
$result
)
||
$result
->
num_rows
()
<=
0
){
$result
=
$this
->
db
->
query
(
"SELECT VEHM.veh_modal_id,VEHM.veh_brand_id
$result
=
$this
->
db
->
query
(
"SELECT VEH.model_id AS veh_modal_id,VEH.veh_brand_id,VEH.year,VEH.trim,
FROM vehicles_model AS VEHM
VEHM.model_name AS model
INNER JOIN vehicles_brand AS VEHB ON VEHB.veh_brand_id = VEHM.veh_brand_id
FROM vehicles AS VEH
INNER JOIN vehicles_brand AS VEHB ON VEHB.veh_brand_id = VEH.veh_brand_id
INNER JOIN vehicle_models AS VEHM ON VEHM.veh_model_id = VEH.model_id
WHERE VEHB.maker LIKE '
$veh_data->make
'
WHERE VEHB.maker LIKE '
$veh_data->make
'
AND VEHM.model LIKE '
$veh_data->model
'"
AND VEH.year LIKE '
$veh_data->year
'
AND VEHM.model_name LIKE '
$veh_data->model
'"
);
);
}
}
//pr($this->db->last_query());
if
(
!
empty
(
$result
)
&&
$result
->
num_rows
()
>
0
&&
!
empty
(
$data
=
$result
->
row
())){
if
(
!
empty
(
$result
)
&&
$result
->
num_rows
()
>
0
&&
!
empty
(
$data
=
$result
->
row
())){
$respArr
[
'data'
]
=
$data
;
$respArr
[
'data'
]
=
$data
;
$respArr
[
'status'
]
=
'success'
;
$respArr
[
'status'
]
=
'success'
;
...
...
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