Commit 346d265e by Jansa Jose

Merge branch 'master' into 'local_production'

Master See merge request !64
parents d8fb4adc e75693f1
...@@ -2606,27 +2606,26 @@ ...@@ -2606,27 +2606,26 @@
public function bulkOrderBooking(){ public function bulkOrderBooking(){
header('Content-type:application/json'); header('Content-type:application/json');
$headers = apache_request_headers(); $headers = apache_request_headers();
if(!isset($headers['Auth']) || empty($headers['Auth'])){ $post = file_get_contents("php://input");
$respArr['status'] = 'error'; if(empty($post) || empty($postData = json_decode($post,true)) ||
$respArr['message'] = 'Authtoken is Required'; !isset($postData['Auth']) || empty($postData['Auth']) ||
echo json_encode($respArr);exit; !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'){ 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']; $postData['customer_id'] = $authRes['data']['customer_id'];
$result = $this->Webservice_model->bulkOrderBooking($postData); $result = $this->Webservice_model->bulkOrderBooking($postData);
if($result['status'] == 'success'){ if($result['status'] == 'success'){
$this->orderPayNowApi($result['data']); $this->orderPayNowApi($result['data']);
} }
echo json_encode($result);exit; $this->fail();
} }
public function orderPayNowApi($transId=''){ public function orderPayNowApi($transId=''){
...@@ -2670,7 +2669,7 @@ ...@@ -2670,7 +2669,7 @@
$result = json_decode($request, true); $result = json_decode($request, true);
} }
$redir = $result['data']['authorization_url']; $redir = $result['data']['authorization_url'];
header("Location: ".$redir); redirect($redir);
} }
public function verify_payment_api($transId='',$payFor='1') { public function verify_payment_api($transId='',$payFor='1') {
...@@ -2716,6 +2715,17 @@ ...@@ -2716,6 +2715,17 @@
header("Location: ".base_url('Webservices/fail/'.$transId.'/'.$payFor)); 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;
}
} }
......
...@@ -913,7 +913,8 @@ class Webservice_model extends CI_Model { ...@@ -913,7 +913,8 @@ class Webservice_model extends CI_Model {
} }
if(empty($transId)){ if(empty($transId)){
header("Location:".base_url('Webservices/fail/')); $respArr['status'] = 'error';
return $respArr;
} }
$respArr['status'] = 'success'; $respArr['status'] = 'success';
...@@ -1121,7 +1122,7 @@ class Webservice_model extends CI_Model { ...@@ -1121,7 +1122,7 @@ class Webservice_model extends CI_Model {
} }
$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 reviews,PRD.product_name,PRD.short_description,PRD.part_id,TRANS.id AS transId, 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 FROM orders ORD
JOIN products PRD ON ORD.product_id = PRD.product_id 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') 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 { ...@@ -1132,6 +1133,8 @@ class Webservice_model extends CI_Model {
FROM product_images FROM product_images
WHERE product_id= PRD.product_id AND WHERE product_id= PRD.product_id AND
PRD.status='1')) 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"); 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())){ if(empty($result) || empty($result = $result->result())){
$respArr['status'] = "error"; $respArr['status'] = "error";
...@@ -1276,6 +1279,44 @@ class Webservice_model extends CI_Model { ...@@ -1276,6 +1279,44 @@ class Webservice_model extends CI_Model {
return $respArr; 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;
}
}
} }
?> ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment