Commit 737edd7d by Jansa Jose

Merge branch 'master' into 'local_production'

Master See merge request !218
parents f065c75d 449b6c51
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
$this->load->model('Webservice_model'); $this->load->model('Webservice_model');
$this->load->library('form_validation'); $this->load->library('form_validation');
define("PAYSTACK_SECRET_KEY", "sk_live_ac1f5350a42852fd3439fdac8ba1d434f1c42360"); //define("PAYSTACK_SECRET_KEY", "sk_live_ac1f5350a42852fd3439fdac8ba1d434f1c42360");
define("PAYSTACK_SECRET_KEY", "sk_test_dae3d816baeeabcab5063def4aad5fe546e9758d");
date_default_timezone_set('Asia/Kolkata'); date_default_timezone_set('Asia/Kolkata');
} }
// customer_login // customer_login
...@@ -1811,6 +1812,7 @@ ...@@ -1811,6 +1812,7 @@
header('Content-type:application/json'); header('Content-type:application/json');
$headers = apache_request_headers(); $headers = apache_request_headers();
$per_page = 10; $per_page = 10;
$total = 0;
$page = (isset($postData['page']) && $postData['page'] != 1) ?$postData['page'] :'1'; $page = (isset($postData['page']) && $postData['page'] != 1) ?$postData['page'] :'1';
$page_limit = ($page - 1) * $per_page; $page_limit = ($page - 1) * $per_page;
$latestResult = $this->Webservice_model->get_latest_product_list(0,0); $latestResult = $this->Webservice_model->get_latest_product_list(0,0);
...@@ -2837,11 +2839,11 @@ ...@@ -2837,11 +2839,11 @@
$msg = 'Provide Registartion type'; $msg = 'Provide Registartion type';
} }
if($postData['isRegistration'] == '1'){ if($postData['isRegistration'] == '1'){
if(!isset($postData['data']['phone']) || empty($postData['data']['phone'])){ if(!isset($postData['phone']) || empty($postData['phone'])){
$err = 1; $err = 1;
$msg = 'Provide a Phone Number'; $msg = 'Provide a Phone Number';
} }
else if(!isset($postData['data']['country_code']) || empty($postData['data']['country_code'])){ else if(!isset($postData['country_code']) || empty($postData['country_code'])){
$err = 1; $err = 1;
$msg = 'Provide a Country code'; $msg = 'Provide a Country code';
} }
...@@ -2851,8 +2853,8 @@ ...@@ -2851,8 +2853,8 @@
echo json_encode($respArr);exit; echo json_encode($respArr);exit;
} }
$postData['profile_image'] = NULL; $postData['profile_image'] = NULL;
$postData['phone'] = (isset($postData['data']['phone']) && !empty($postData['data']['phone']))?$postData['data']['phone']:''; $postData['phone'] = (isset($postData['phone']) && !empty($postData['phone']))?$postData['phone']:'';
$postData['country_code'] = (isset($postData['data']['country_code']) && !empty($postData['data']['country_code']))?$postData['data']['country_code']:''; $postData['country_code'] = (isset($postData['country_code']) && !empty($postData['country_code']))?$postData['country_code']:'';
if(isset($postData['data']['profileImg']) && !empty($postData['data']['profileImg'])){ if(isset($postData['data']['profileImg']) && !empty($postData['data']['profileImg'])){
$imageData = file_get_contents($postData['data']['profileImg']); $imageData = file_get_contents($postData['data']['profileImg']);
$userlImg = 'assets/uploads/services/userImg_'.time().'.jpg'; $userlImg = 'assets/uploads/services/userImg_'.time().'.jpg';
...@@ -2868,7 +2870,16 @@ ...@@ -2868,7 +2870,16 @@
if(empty($custReg)){ if(empty($custReg)){
echo json_encode($respArr);exit; echo json_encode($respArr);exit;
} }
if($custReg == '1' || $custReg == '2'){ if($custReg == '2'){
$respArr['status'] = '0';
$respArr['message'] = 'Email Id Already Exist';
echo json_encode($respArr);exit;
} else if($custReg == '3'){
$respArr['status'] = '0';
$respArr['message'] = 'Phone Number Already Exist';
echo json_encode($respArr);exit;
}
else if($custReg == '1'){
$respArr = $this->getUserDetails($postData); $respArr = $this->getUserDetails($postData);
} }
}else{ }else{
...@@ -2880,7 +2891,6 @@ ...@@ -2880,7 +2891,6 @@
public function getUserDetails($postData){ public function getUserDetails($postData){
$custResp = $this->Webservice_model->checkSocialCustomerLogin($postData); $custResp = $this->Webservice_model->checkSocialCustomerLogin($postData);
//pr($custResp);
if(isset($custResp['status']) && $custResp['status'] == '2'){ if(isset($custResp['status']) && $custResp['status'] == '2'){
$respArr['message'] = 'User Not Registered Yet'; $respArr['message'] = 'User Not Registered Yet';
$respArr['status'] = '0'; $respArr['status'] = '0';
......
...@@ -368,15 +368,10 @@ class Webservice_model extends CI_Model { ...@@ -368,15 +368,10 @@ class Webservice_model extends CI_Model {
$car_loc_lat = (isset($postData['location_lat']) && !empty($postData['location_lat']))?$postData['location_lat']:''; $car_loc_lat = (isset($postData['location_lat']) && !empty($postData['location_lat']))?$postData['location_lat']:'';
$car_loc_lng = (isset($postData['location_lng']) && !empty($postData['location_lng']))?$postData['location_lng']:''; $car_loc_lng = (isset($postData['location_lng']) && !empty($postData['location_lng']))?$postData['location_lng']:'';
$insert_array = array( $insert_array = array(
'cost'=>$cost, 'cost'=>$cost,'scheduled_date'=>$date,'scheduled_time'=>$time,'issues_selected'=>$issues,
'scheduled_date'=>$date,
'scheduled_time'=>$time,
'issues_selected'=>$issues,
'service_type'=>(isset($postData['is_emergency']) && !empty($postData['is_emergency']))?2:1, 'service_type'=>(isset($postData['is_emergency']) && !empty($postData['is_emergency']))?2:1,
'status'=>(isset($postData['is_emergency']) && !empty($postData['is_emergency']))?1:5, 'status'=>(isset($postData['is_emergency']) && !empty($postData['is_emergency']))?1:5,
'car_location'=> $car_location, 'car_location'=> $car_location,'car_loc_lat'=>$car_loc_lat,'car_loc_lng'=>$car_loc_lng
'car_loc_lat'=>$car_loc_lat,
'car_loc_lng'=>$car_loc_lng
); );
if($this->db->update('bookings',$insert_array,array('booking_id'=>$postData['booking_id']))){ if($this->db->update('bookings',$insert_array,array('booking_id'=>$postData['booking_id']))){
$this->db->insert("mechanic_booking",array('booking_id'=>$postData['booking_id'],'mechanic_id'=>$postData['mechanic_id'],'amount'=>$cost,'status'=>'0')); $this->db->insert("mechanic_booking",array('booking_id'=>$postData['booking_id'],'mechanic_id'=>$postData['mechanic_id'],'amount'=>$cost,'status'=>'0'));
...@@ -390,8 +385,6 @@ class Webservice_model extends CI_Model { ...@@ -390,8 +385,6 @@ class Webservice_model extends CI_Model {
$this->db->group_by('bookings.booking_id'); $this->db->group_by('bookings.booking_id');
$mech_data = $this->db->get_where('bookings',array('bookings.booking_id'=>$postData['booking_id'])); $mech_data = $this->db->get_where('bookings',array('bookings.booking_id'=>$postData['booking_id']));
// pr($this->db->last_query());
if(!empty($mech_data) && !empty($mechanic_data = $mech_data->row_array())){ if(!empty($mech_data) && !empty($mechanic_data = $mech_data->row_array())){
$this->db->insert('transaction',array('customer_id'=>$mechanic_data['customer_id'],'booking_id'=>$postData['booking_id'],'payment_for'=>'1','datetime'=>date('Y-m-d h:i:s'),'amount'=>$cost)); $this->db->insert('transaction',array('customer_id'=>$mechanic_data['customer_id'],'booking_id'=>$postData['booking_id'],'payment_for'=>'1','datetime'=>date('Y-m-d h:i:s'),'amount'=>$cost));
...@@ -762,6 +755,7 @@ class Webservice_model extends CI_Model { ...@@ -762,6 +755,7 @@ class Webservice_model extends CI_Model {
$this->db->query("UPDATE bookings $this->db->query("UPDATE bookings
JOIN transaction ON transaction.booking_id=bookings.booking_id JOIN transaction ON transaction.booking_id=bookings.booking_id
SET bookings.status = $status WHERE transaction.id = $transId"); SET bookings.status = $status WHERE transaction.id = $transId");
$this->db->query("UPDATE mechanic_booking SET status = $status WHERE booking_id =".$bookData->booking_id);
} }
return 1; return 1;
} }
......
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