Commit 35b13554 by Tobin

api for checker

parent 3a1f9d8f
......@@ -499,5 +499,27 @@ class Api extends CI_Controller {
);
return $BayanPayArray;
}
public function checker_bookingDetails(){
$data = (array) json_decode(file_get_contents('php://input'));
$res = $this->Api_model->checkerbookingdetails($data);
if($res['status']!=0){
$this->response($res['data']);
}
else{
$this->errorResponse($res['code'],$res['message']);
}
}
public function checker_login(){
$data = (array) json_decode(file_get_contents('php://input'));
$res = $this->Api_model->checker_login($data);
if($res['status']!=0){
$this->response($res['data']);
}
else{
$this->errorResponse($res['code'],$res['message']);
}
}
}
?>
\ No newline at end of file
......@@ -951,5 +951,59 @@ class Api_model extends CI_Model {
}
return $res;
}
public function checker_login($data){
try{
$this->db->where('status',1);
$this->db->where('password',md5($data['password']));
$this->db->where('username',$data['email']);
$this->db->from('checker');
$result = $this->db->get()->row();
if($result){
$res = array('status'=>1,'data'=>array('checker_id'=>$result->id));
} else {
$res = array('status'=>0,'message'=>'Invalid Email Id / Password','code'=>'ER05');
}
} catch(Exception $e) {
$res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06');
}
return $res;
}
function checkerbookingdetails($data) {
try {
$count = $this->db->get_where('checker',array('id'=>$data['checker_id']))->num_rows();
if($count > 0){
$result = $this->db
->select('booking.id AS book_id,booking.bookId,customer.name AS customer_name,
booking.status,booking.no_of_ticket,booking.qrcode,
booking.ticket_details,booking.booking_date')
->where('booking.bookId',$data['qr_pin'])
->from('booking')
->join('events','booking.event_id = events.event_id')
->join('event_date_time','booking.event_date_id = event_date_time.id')
->join('venue', 'venue.id = events.venue_id')
->join('event_gallery', 'events.event_id = event_gallery.event_id', 'LEFT')
->join('customer','customer.customer_id = booking.customer_id')
->join('host_categories', 'venue.host_cat_id = host_categories.host_cat_id')
->group_by('booking.bookId')->get()->row();
if(count($result)>0){
$result->seat_class = '';
if(!empty($ticketDetls = json_decode($result->ticket_details))){
$result->seat_class = $ticketDetls[0]->color;
}
$res = array('status'=>1,'data'=>$result);
} else {
$res = array('status'=>0,'message'=>'Invalid booking code','code'=>'ER24');
}
}else{
$res = array('status'=>0,'message'=>'Checker Doesnot Exist','code'=>'ER24');
}
} catch(Exception $e) {
$res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06');
}
return $res;
}
}
?>
......@@ -296,6 +296,34 @@ class Validation_model extends CI_Model {
)
)
) ,
'checker_bookingDetails' => array(
'qr_pin' => array(
'required' => array(
'code' => 'ER17',
'message' => 'Booking Id is null or empty'
) ,
) ,
'checker_id' => array(
'required' => array(
'code' => 'ER20',
'message' => 'User Id is null or empty'
) ,
)
) ,
'checker_login' => array(
'email' => array(
'required' => array(
'code' => 'ER17',
'message' => 'Email Id is null or empty'
)
) ,
'password' => array(
'required' => array(
'code' => 'ER20',
'message' => 'Password is null or empty'
)
)
) ,
'payNow' => array(),
'searchEvent' => array()
);
......
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