Commit 639dbe15 by Jansa Jose

location update

parent 09172077
...@@ -303,12 +303,15 @@ ...@@ -303,12 +303,15 @@
$post = file_get_contents("php://input"); $post = file_get_contents("php://input");
$postData = json_decode($post, true); $postData = json_decode($post, true);
if(!isset($postData['lat']) && empty($postData['lat'])){ if(!isset($postData['location']) && empty($postData['location'])){
$respArr['message'] = "Latitude is Required"; $respArr['message'] = "Location is Required";
echo json_encode($respArr) ;exit; echo json_encode($respArr) ;exit;
}else if(!isset($postData['lng']) && empty($postData['lng'])){ }else if(!isset($postData['location_lng']) && empty($postData['location_lng'])){
$respArr['message'] = "Longitude is Required"; $respArr['message'] = "Longitude is Required";
echo json_encode($respArr) ;exit; echo json_encode($respArr) ;exit;
}else if(!isset($postData['location_lat']) && empty($postData['location_lat'])){
$respArr['message'] = "Latitude is Required";
echo json_encode($respArr) ;exit;
} }
$postData['mechanic_id'] = $authRes['data']['mechanic_id']; $postData['mechanic_id'] = $authRes['data']['mechanic_id'];
......
...@@ -11,7 +11,7 @@ function checkMechanicLogin($userLogData){ ...@@ -11,7 +11,7 @@ function checkMechanicLogin($userLogData){
if(empty($userLogData)){ if(empty($userLogData)){
return $respArr; return $respArr;
} }
$this->db->select("MCH.mechanic_id as user_id,TRIM(CONCAT(MCH.first_name,' ' ,IFNULL(MCH.last_name,''))) as name,MCH.email_id,MCH.phone as phone_number,IFNULL(MCHSHP.shop_name,'') as workshop_name,MCH.city,MCH.location as place"); $this->db->select("MCH.mechanic_id as user_id,TRIM(CONCAT(MCH.first_name,' ' ,IFNULL(MCH.last_name,''))) as name,MCH.email_id,MCH.phone as phone_number,IFNULL(MCHSHP.shop_name,'') as workshop_name,MCH.city,MCH.location as place,MCH.is_online");
$this->db->from('admin_users as AU'); $this->db->from('admin_users as AU');
$this->db->join('mechanic as MCH','MCH.mechanic_id = AU.id'); $this->db->join('mechanic as MCH','MCH.mechanic_id = AU.id');
$this->db->join('mechanic_shop as MCHSHP','MCHSHP.shop_id = MCH.shop_id','LEFT'); $this->db->join('mechanic_shop as MCHSHP','MCHSHP.shop_id = MCH.shop_id','LEFT');
...@@ -217,7 +217,7 @@ public function add_location($postData){ ...@@ -217,7 +217,7 @@ public function add_location($postData){
if(empty($postData)){ if(empty($postData)){
return $respArr; return $respArr;
} }
if($this->db->update('mechanic',array('location_lat'=>$postData['location_lat'],'location_lng'=>$postData['location_lng']),array('mechanic_id'=>$postData['mechanic_id']))){ if($this->db->update('mechanic',array('location'=>$postData['location'],'location_lat'=>$postData['location_lat'],'location_lng'=>$postData['location_lng']),array('mechanic_id'=>$postData['mechanic_id']))){
$respArr['status'] = "success"; $respArr['status'] = "success";
$respArr['message'] = "Location Updated Successfully"; $respArr['message'] = "Location Updated Successfully";
} }
......
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