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
346d265e
Commit
346d265e
authored
Jun 18, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'local_production'
Master See merge request
!64
parents
d8fb4adc
e75693f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
15 deletions
+66
-15
Webservices.php
application/controllers/Webservices.php
+23
-13
Webservice_model.php
application/models/Webservice_model.php
+43
-2
No files found.
application/controllers/Webservices.php
View file @
346d265e
...
...
@@ -2606,27 +2606,26 @@
public
function
bulkOrderBooking
(){
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
;
$post
=
file_get_contents
(
"php://input"
);
if
(
empty
(
$post
)
||
empty
(
$postData
=
json_decode
(
$post
,
true
))
||
!
isset
(
$postData
[
'Auth'
])
||
empty
(
$postData
[
'Auth'
])
||
!
isset
(
$postData
[
'data'
])
||
empty
(
$postData
[
'data'
])){
$this
->
fail
();
}
$authRes
=
$this
->
Webservice_model
->
get_customer_authtoken
(
$
headers
[
'Auth'
]);
$authRes
=
$this
->
Webservice_model
->
get_customer_authtoken
(
$
postData
[
'Auth'
]);
if
(
$authRes
[
'status'
]
==
'error'
){
echo
json_encode
(
$authRes
);
exit
;
$this
->
fail
()
;
}
$post
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$post
,
true
);
$postData
[
'customer_id'
]
=
$authRes
[
'data'
][
'customer_id'
];
$result
=
$this
->
Webservice_model
->
bulkOrderBooking
(
$postData
);
if
(
$result
[
'status'
]
==
'success'
){
$this
->
orderPayNowApi
(
$result
[
'data'
]);
}
echo
json_encode
(
$result
);
exit
;
$this
->
fail
()
;
}
public
function
orderPayNowApi
(
$transId
=
''
){
...
...
@@ -2670,7 +2669,7 @@
$result
=
json_decode
(
$request
,
true
);
}
$redir
=
$result
[
'data'
][
'authorization_url'
];
header
(
"Location: "
.
$redir
);
redirect
(
$redir
);
}
public
function
verify_payment_api
(
$transId
=
''
,
$payFor
=
'1'
)
{
...
...
@@ -2716,6 +2715,17 @@
header
(
"Location: "
.
base_url
(
'Webservices/fail/'
.
$transId
.
'/'
.
$payFor
));
}
}
public
function
socialLogin
(){
header
(
'Content-type:application/json'
);
$headers
=
apache_request_headers
();
$post
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$post
,
true
);
$result
=
$this
->
Webservice_model
->
socialLogin
(
$postData
);
echo
json_encode
(
$result
);
exit
;
}
}
...
...
application/models/Webservice_model.php
View file @
346d265e
...
...
@@ -913,7 +913,8 @@ class Webservice_model extends CI_Model {
}
if
(
empty
(
$transId
)){
header
(
"Location:"
.
base_url
(
'Webservices/fail/'
));
$respArr
[
'status'
]
=
'error'
;
return
$respArr
;
}
$respArr
[
'status'
]
=
'success'
;
...
...
@@ -1121,7 +1122,7 @@ class Webservice_model extends CI_Model {
}
$result
=
$this
->
db
->
query
(
"SELECT ROUND(AVG(REV.rating),2) AS rating,
COUNT(REV.id) AS reviews,PRD.product_name,PRD.short_description,PRD.part_id,TRANS.id AS transId,
TRANS.status AS tranStatus,TRANS.datetime,ORD.*,PI.image as product_image
TRANS.status AS tranStatus,TRANS.datetime,ORD.*,PI.image as product_image
,BRND.brand_name
FROM orders ORD
JOIN products PRD ON ORD.product_id = PRD.product_id
JOIN transaction TRANS ON (ORD.order_id = TRANS.booking_id AND TRANS.payment_for= '2')
...
...
@@ -1132,6 +1133,8 @@ class Webservice_model extends CI_Model {
FROM product_images
WHERE product_id= PRD.product_id AND
PRD.status='1'))
JOIN product_brand AS BRND ON BRND.brand_id = PRD.brand_id
WHERE ORD.customer_id="
.
$postData
[
'customer_id'
]
.
" GROUP BY ORD.order_id ORDER BY ORD.order_id DESC
$lmt
"
);
if
(
empty
(
$result
)
||
empty
(
$result
=
$result
->
result
())){
$respArr
[
'status'
]
=
"error"
;
...
...
@@ -1276,6 +1279,44 @@ class Webservice_model extends CI_Model {
return
$respArr
;
}
public
function
socialLogin
(
$postData
=
array
()){
$respArr
=
array
(
'status'
=>
'error'
);
if
(
empty
(
$postData
[
'data'
])){
$respArr
[
'message'
]
=
'All Field is Required'
;
}
$result
=
$this
->
db
->
get_where
(
'customers'
,
array
(
'email'
=>
$postData
[
'data'
][
'email'
],
'status'
=>
'1'
));
if
(
!
empty
(
$result
)
&&
$result
->
num_rows
()
==
1
&&
!
empty
(
$custData
=
$result
->
row
())){
$respArr
[
'data'
]
=
$custData
;
$respArr
[
'status'
]
=
1
;
return
$respArr
;
}
if
(
empty
(
$result
)
||
$result
->
num_rows
()
<
1
||
empty
(
$custData
=
$result
->
row
())){
$postData
[
'data'
][
'profile_image'
]
=
''
;
$postData
[
'data'
][
'is_otp_verified'
]
=
1
;
if
(
isset
(
$postData
[
'data'
],
$postData
[
'data'
][
'image_url'
])
&&
!
empty
(
$postData
[
'data'
][
'image_url'
])){
$imageData
=
file_get_contents
(
$postData
[
'data'
][
'image_url'
]);
$userlImg
=
'assets/uploads/services/userImg_'
.
time
()
.
'.jpg'
;
file_put_contents
(
$userlImg
,
$imageData
);
$postData
[
'data'
][
'profile_image'
]
=
$userlImg
;
}
unset
(
$postData
[
'data'
][
'image_url'
]);
$this
->
db
->
insert
(
'customers'
,
$postData
[
'data'
]);
$last_id
=
$this
->
db
->
insert_id
();
$custData
=
$this
->
db
->
get_where
(
'customers'
,
array
(
'customer_id'
=>
$last_id
))
->
row
();
$respArr
[
'data'
]
=
$custData
;
$respArr
[
'status'
]
=
1
;
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