Commit 113f1a0f by Tobin

t : checker api migration from api to orag

parent b6a5d60e
......@@ -75,10 +75,10 @@ $query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'nuvento_timeout',
'hostname' => '192.168.140.123',
'username' => 'root',
'password' => 'Golden_123',
'database' => 'nuvento_timeout',
'database' => 'tobin_eventTimeOut',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
......
......@@ -684,41 +684,5 @@ class Api extends CI_Controller {
redirect($redUrl.'failure');
}
}
/*================ START : Checker API ================*/
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']);
}
}
public function getCheckerBookList(){
$data = (array) json_decode(file_get_contents('php://input'));
$res = $this->Api_model->getCheckerBookList($data);
if(isset($res['data']) && !empty($res['data'])){
$this->response($res['data']);
}
else{
$this->errorResponse($res['code'],$res['message']);
}
}
/*================ END : Checker API ================*/
}
?>
......@@ -330,6 +330,28 @@ class OrganizerServices extends CI_Controller {
}
}
public function checker_bookingDetails(){
$data = (array) json_decode(file_get_contents('php://input'));
$res = $this->Organizer_model->checkerbookingdetails($data);
if($res['status']!=0){
$this->response($res['data']);
}
else{
$this->errorResponse($res['code'],$res['message']);
}
}
public function getCheckerBookList(){
$data = (array) json_decode(file_get_contents('php://input'));
$res = $this->Organizer_model->getCheckerBookList($data);
if(isset($res['data']) && !empty($res['data'])){
$this->response($res['data']);
}
else{
$this->errorResponse($res['code'],$res['message']);
}
}
/*================ END : Organizer API ================*/
}
?>
......@@ -1706,123 +1706,5 @@ class Api_model extends CI_Model {
$res = array('status'=>0,'message'=>'Invalid user','code'=>'ER19');
}
}
/*================ START : Checker API ================*/
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,event_date_time.date AS booking_date')
->where(array('booking.bookId'=>$data['qr_pin'],'status'=>'1'))
->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))){
if(is_array($ticketDetls) && isset($ticketDetls[0]) && isset($ticketDetls[0]->color)){
$result->seat_class = $ticketDetls[0]->color;
} else if (isset($ticketDetls->color)){
$result->seat_class = $ticketDetls->color;
}
}
$this->db->insert('checker_bookings',
array('checker_id'=>$data['checker_id'],'booking_id'=>$data['qr_pin'],
'checked_time'=>date('Y-m-d H:i:s')));
$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;
}
function getCheckerBookList($data) {
try {
$checker_id = $data['checker_id'];
$count = $this->db->get_where('checker',array('id'=>$checker_id,'status'=>'1'))->num_rows();
if($count > 0){
$sql = "SELECT BOOK.bookId AS booking_id
FROM checker_bookings AS CBOOK
INNER JOIN checker AS CHK ON (CHK.id=$checker_id)
INNER JOIN booking AS BOOK ON (BOOK.bookId=CBOOK.booking_id)
INNER JOIN events AS EVT ON (EVT.event_id=BOOK.event_id)
WHERE EVT.provider_id=CHK.provider_id AND BOOK.status='1'";
$count = $this->db->query($sql)->num_rows();
if($count > 0) {
$perPage = 10;
$page = (isset($data['page']))?$data['page']:1;
$limit = ($page - 1) * $perPage;
$meta = array('total_pages'=>ceil($count/$perPage),'total'=>$count,
'current_page'=>$page,'per_page'=>$perPage);
if($count > $limit) {
$sql = "SELECT TEVT.event_name,TCAT.category_name,CUST.name,EDATE.date,
EDATE.time,BOOK.amount,BOOK.bookId AS booking_id
FROM checker_bookings AS CBOOK
INNER JOIN checker AS CHK ON (CHK.id=CBOOK.checker_id)
INNER JOIN booking AS BOOK ON (BOOK.bookId=CBOOK.booking_id)
INNER JOIN events AS EVT ON (EVT.event_id=BOOK.event_id AND
EVT.provider_id=CHK.provider_id)
INNER JOIN event_date_time AS EDATE ON (EDATE.event_id=EVT.event_id)
INNER JOIN event_category AS CAT ON (CAT.cat_id=EVT.category_id)
INNER JOIN customer AS CUST ON (CUST.customer_id=BOOK.customer_id)
INNER JOIN translator_event AS TEVT ON (TEVT.event_id=EVT.event_id)
INNER JOIN translator_category AS TCAT ON (TCAT.category_id=CAT.cat_id)
WHERE CBOOK.checker_id='$checker_id' AND TEVT.language_code='EN' AND
TCAT.language_code='EN' AND BOOK.status='1'";
$result = $this->db->query($sql)->result();
$resp = array('data'=>$result,'meta'=>$meta);
$res = array('status'=>1,'message'=>'Successfully','data'=>$resp);
} else {
$resp = array('data'=>[],'meta'=>$meta);
$res = array('status'=>1,'message'=>'No More Data Found','data'=>$resp);
}
} else {
$res = array('status'=>0,'message'=>'No Record Found','code'=>'ER24');
}
} else {
$res = array('status'=>0,'message'=>'Checker Doesnot Exist','code'=>'ER25');
}
} catch(Exception $e) {
$res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06');
}
return $res;
}
}
?>
\ No newline at end of file
......@@ -987,6 +987,104 @@ class Organizer_model extends CI_Model {
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,event_date_time.date AS booking_date')
->where(array('booking.bookId'=>$data['qr_pin'],'status'=>'1'))
->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))){
if(is_array($ticketDetls) && isset($ticketDetls[0]) && isset($ticketDetls[0]->color)){
$result->seat_class = $ticketDetls[0]->color;
} else if (isset($ticketDetls->color)){
$result->seat_class = $ticketDetls->color;
}
}
$this->db->insert('checker_bookings',
array('checker_id'=>$data['checker_id'],'booking_id'=>$data['qr_pin'],
'checked_time'=>date('Y-m-d H:i:s')));
$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;
}
function getCheckerBookList($data) {
try {
$checker_id = $data['checker_id'];
$count = $this->db->get_where('checker',array('id'=>$checker_id,'status'=>'1'))->num_rows();
if($count > 0){
$sql = "SELECT BOOK.bookId AS booking_id
FROM checker_bookings AS CBOOK
INNER JOIN checker AS CHK ON (CHK.id=$checker_id)
INNER JOIN booking AS BOOK ON (BOOK.bookId=CBOOK.booking_id)
INNER JOIN events AS EVT ON (EVT.event_id=BOOK.event_id)
WHERE EVT.provider_id=CHK.provider_id AND BOOK.status='1'";
$count = $this->db->query($sql)->num_rows();
if($count > 0) {
$perPage = 10;
$page = (isset($data['page']))?$data['page']:1;
$limit = ($page - 1) * $perPage;
$meta = array('total_pages'=>ceil($count/$perPage),'total'=>$count,
'current_page'=>$page,'per_page'=>$perPage);
if($count > $limit) {
$sql = "SELECT TEVT.event_name,TCAT.category_name,CUST.name,EDATE.date,
EDATE.time,BOOK.amount,BOOK.bookId AS booking_id
FROM checker_bookings AS CBOOK
INNER JOIN checker AS CHK ON (CHK.id=CBOOK.checker_id)
INNER JOIN booking AS BOOK ON (BOOK.bookId=CBOOK.booking_id)
INNER JOIN events AS EVT ON (EVT.event_id=BOOK.event_id AND
EVT.provider_id=CHK.provider_id)
INNER JOIN event_date_time AS EDATE ON (EDATE.event_id=EVT.event_id)
INNER JOIN event_category AS CAT ON (CAT.cat_id=EVT.category_id)
INNER JOIN customer AS CUST ON (CUST.customer_id=BOOK.customer_id)
INNER JOIN translator_event AS TEVT ON (TEVT.event_id=EVT.event_id)
INNER JOIN translator_category AS TCAT ON (TCAT.category_id=CAT.cat_id)
WHERE CBOOK.checker_id='$checker_id' AND TEVT.language_code='EN' AND
TCAT.language_code='EN' AND BOOK.status='1'";
$result = $this->db->query($sql)->result();
$resp = array('data'=>$result,'meta'=>$meta);
$res = array('status'=>1,'message'=>'Successfully','data'=>$resp);
} else {
$resp = array('data'=>[],'meta'=>$meta);
$res = array('status'=>1,'message'=>'No More Data Found','data'=>$resp);
}
} else {
$res = array('status'=>0,'message'=>'No Record Found','code'=>'ER24');
}
} else {
$res = array('status'=>0,'message'=>'Checker Doesnot Exist','code'=>'ER25');
}
} catch(Exception $e) {
$res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06');
}
return $res;
}
}
?>
......@@ -312,20 +312,6 @@ 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'
) ,
)
) ,
'reset_password' => array(
'reset_key' => array(
'required' => array(
......@@ -340,20 +326,6 @@ class Validation_model extends CI_Model {
) ,
)
) ,
'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(),
'validate_promo_code' => array(
......@@ -382,14 +354,6 @@ class Validation_model extends CI_Model {
)
)
),
'getCheckerBookList'=>array(
'checker_id' => array(
'required' => array(
'code' => 'ER04',
'message' => 'checker ID is null or empty'
)
)
),
'getSavedCards'=>array(
'email' => array(
'required' => array(
......@@ -404,286 +368,6 @@ class Validation_model extends CI_Model {
)
)
),
'getOrganizerEventList'=>array(
'organiser_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Organizer ID is null or empty'
)
)
),
'getOrganizerEventDetails'=>array(
'organiser_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Organizer ID is null or empty'
)
),
'event_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Event ID is null or empty'
)
)
),
'editOrganizerEventDetails'=>array(
'organiser_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Organizer ID is null or empty'
)
),
'event_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Event ID is null or empty'
)
),
'event_name_en' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Event name is null or empty'
)
),
'category' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Category is null or empty'
)
),
'maximum_seat_booking' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Maximum Seat Booking Filed is null or empty'
)
),
'payment_mode' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Payment Mode is null or empty'
)
),
'images' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Images is null or empty'
)
),
'event_desc_en' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Event Description is null or empty'
)
),
'price' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Price Field is null or empty'
)
),
'capacity' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Capacity Field is null or empty'
)
),
'about_price_division_en' => array(
'required' => array(
'code' => 'ER18',
'message' => 'About Price Division is null or empty'
)
),
'show_type' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Show Type is null or empty'
)
),
'start_date' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Start Date is null or empty'
)
),
'end_date' => array(
'required' => array(
'code' => 'ER18',
'message' => 'End Date is null or empty'
)
),
'show_timing' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Show Timing is null or empty'
)
),
'tag' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Tag is null or empty'
)
)
),
'deleteOrganizerEvent'=>array(
'organiser_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Organizer ID is null or empty'
)
),
'event_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Event ID is null or empty'
)
)
),
'deActivateOrganizerEvent'=>array(
'organiser_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Organizer ID is null or empty'
)
),
'event_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Event ID is null or empty'
)
)
),
'getVenueList'=>array(
'organiser_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Organizer ID is null or empty'
)
)
),
'getVenueDetails'=>array(
'organiser_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Organizer ID is null or empty'
)
),
'venue_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Venue ID is null or empty'
)
)
),
'getCustomerList'=>array(
'organiser_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Organizer ID is null or empty'
)
)
),
'getBookingList'=>array(
'organiser_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Organizer ID is null or empty'
)
)
),
'getBookingDetails'=>array(
'booking_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Booking ID is null or empty'
)
)
),
'organiserSignUp'=>array(
'username' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Username is null or empty'
)
),
'email_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Email Id is null or empty'
)
),
'contact_no' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Contact Number is null or empty'
)
),
'password' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Password is null or empty'
)
)
),
'signIn'=>array(
'email_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Email Id is null or empty'
)
),
'password' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Password is null or empty'
)
),
'user_type' => array(
'required' => array(
'code' => 'ER18',
'message' => 'User Type is null or empty'
)
),
),
'changePassword'=>array(
'new_password' => array(
'required' => array(
'code' => 'ER18',
'message' => 'New Password is null or empty'
)
),
'confirm_password' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Confirm Password is null or empty'
)
),
'user_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'User Id is null or empty'
)
),
'user_type' => array(
'required' => array(
'code' => 'ER18',
'message' => 'User Type is null or empty'
)
),
),
'checkerDeactivate'=>array(
'checker_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Checker Id is null or empty'
)
),
'organiser_id' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Organizer Id is null or empty'
)
)
),
'getTagList'=>array(
'organiser_id' => array(
'required' => array(
......
......@@ -371,6 +371,28 @@ class Validation_organizer_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'
) ,
)
),
'getCheckerBookList'=>array(
'checker_id' => array(
'required' => array(
'code' => 'ER04',
'message' => 'checker ID is null or empty'
)
)
)
);
public function _consruct(){
......
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