Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
TimeOutAdmin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TimeOut
TimeOutAdmin
Commits
c65d1d6e
Commit
c65d1d6e
authored
5 years ago
by
Tobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dc
parent
99a87bee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
59 deletions
+60
-59
Api.php
application/controllers/Api.php
+1
-1
Api_model.php
application/models/Api_model.php
+42
-41
Webservice_model.php
application/models/Webservice_model.php
+17
-17
No files found.
application/controllers/Api.php
View file @
c65d1d6e
...
...
@@ -466,7 +466,7 @@ class Api extends CI_Controller {
}
if
(
!
empty
(
$transaction_id
)
&&
!
empty
(
$last_id
)){
$this
->
Api_model
->
update_payment
(
$response
,
$transaction_id
,
$last_id
,
'1'
)
;
$this
->
Api_model
->
update_payment
(
$response
,
$transaction_id
,
$last_id
,
'1'
);
}
if
(
!
empty
(
$booking_id
)){
...
...
This diff is collapsed.
Click to expand it.
application/models/Api_model.php
View file @
c65d1d6e
...
...
@@ -394,7 +394,7 @@ class Api_model extends CI_Model {
JOIN venue ON venue.id=events.venue_id
LEFT JOIN event_gallery ON events.event_id=event_gallery.event_id AND
event_gallery.media_type=0
WHERE customer_id='
$user_id
' AND booking.status IN(0,1,2)
WHERE customer_id='
$user_id
' AND booking.status IN(0,1,2
,6
)
GROUP BY booking.id ORDER BY booking.id DESC LIMIT 10"
;
$result
=
$this
->
db
->
query
(
$sql
)
->
result_array
();
...
...
@@ -451,17 +451,12 @@ class Api_model extends CI_Model {
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$res_count
=
$this
->
db
->
where
(
'bookId'
,
$data
[
'bookingCode'
])
->
where
(
'status'
,
1
)
->
get
(
'booking'
)
->
num_rows
();
if
(
$res_count
>
0
)
{
$rs
=
$this
->
db
->
where
(
'bookId'
,
$data
[
'bookingCode'
])
->
update
(
'booking'
,
array
(
'status'
=>
0
));
if
(
$rs
)
{
$res
=
array
(
'status'
=>
1
,
'data'
=>
null
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Cancel submission failed'
,
'code'
=>
'ER25'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Invalid booking code'
,
'code'
=>
'ER24'
);
}
$rs
=
$this
->
db
->
where
(
'bookId'
,
$data
[
'bookingCode'
])
->
update
(
'booking'
,
array
(
'status'
=>
0
));
if
(
$rs
)
{
$res
=
array
(
'status'
=>
1
,
'data'
=>
null
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Cancel submission failed'
,
'code'
=>
'ER25'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Invalid user'
,
'code'
=>
'ER19'
);
}
...
...
@@ -599,29 +594,35 @@ class Api_model extends CI_Model {
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$post_data
=
$data
;
$status
=
(
isset
(
$post_data
[
'has_payment'
])
&&
$post_data
[
'has_payment'
]
==
0
)
?
'1'
:
'3'
;
$post_data
[
'status'
]
=
$status
;
$post_data
[
'bookId'
]
=
'TO'
.
date
(
'ymd'
)
.
str_pad
(
rand
(
1111
,
9999
),
4
,
0
,
STR_PAD_LEFT
);
$post_data
[
'qrcode'
]
=
genQRcode
(
$post_data
[
'bookId'
]);
$post_data
[
'customer_id'
]
=
$user_id
;
$post_data
[
'booking_date'
]
=
date
(
'Y-m-d H:i:s'
);
$post_data
[
'ticket_details'
]
=
json_encode
(
$post_data
[
'ticket_details'
]);
if
(
!
isset
(
$post_data
[
'amount'
])
||
$post_data
[
'amount'
]
==
''
){
$post_data
[
'amount'
]
=
0
;
$post_data
[
'amount'
]
=
0
;
}
$evtData
=
$this
->
db
->
get_where
(
'events'
,
array
(
'event_id'
=>
$post_data
[
'event_id'
]));
$evtData
=
$evtData
->
row_array
();
if
(
!
empty
(
$evtData
)
&&
isset
(
$evtData
[
'approve_booking'
])
&&
$evtData
[
'approve_booking'
]
==
'1'
){
$post_data
[
'status'
]
=
'6'
;
}
$promocodeData
=
array
();
if
(
isset
(
$post_data
[
'promocode_id'
])
&&
!
empty
(
$post_data
[
'promocode_id'
])
&&
isset
(
$post_data
[
'redeem_amount'
])
&&
!
empty
(
$post_data
[
'redeem_amount'
])){
$
status
=
(
$post_data
[
'status'
]
==
'1'
)
?
1
:
0
;
$
promoStatus
=
(
$post_data
[
'status'
]
==
'1'
)
?
1
:
0
;
$promocodeData
=
array
(
'user_id'
=>
$user_id
,
'booking_id'
=>
$post_data
[
'bookId'
],
'promocode_id'
=>
$post_data
[
'promocode_id'
],
'redeem_amount'
=>
$post_data
[
'redeem_amount'
],
'created_date'
=>
date
(
'Y-m-d H:i:s'
),
'status'
=>
$
s
tatus
);
'created_date'
=>
date
(
'Y-m-d H:i:s'
),
'status'
=>
$
promoS
tatus
);
}
unset
(
$post_data
[
'auth_token'
],
$post_data
[
'has_payment'
],
$post_data
[
'promocode_id'
],
$post_data
[
'redeem_amount'
]);
...
...
@@ -1336,31 +1337,29 @@ class Api_model extends CI_Model {
if
(
empty
(
$last_id
)){
return
;
}
$this
->
db
->
update
(
'transaction'
,
array
(
'transaction_id'
=>
$transactionid
,
'transaction_response'
=>
json_encode
(
$response
),
'status'
=>
$status
),
array
(
'id'
=>
$last_id
));
$this
->
db
->
update
(
'transaction'
,
array
(
'transaction_id'
=>
$transactionid
,
'transaction_response'
=>
json_encode
(
$response
),
'status'
=>
$status
),
array
(
'id'
=>
$last_id
));
if
(
$status
==
1
){
$trBook
=
$this
->
db
->
get_where
(
'transaction'
,
array
(
'id'
=>
$last_id
))
->
row_array
();
$book_id
=
$trBook
[
'booking_id'
];
$this
->
db
->
update
(
'booking'
,
array
(
'status'
=>
'1'
),
array
(
'bookId'
=>
$book_id
));
$this
->
db
->
update
(
'event_invites'
,
array
(
'status'
=>
'1'
),
array
(
'book_id'
=>
$book_id
));
$this
->
db
->
update
(
'promocode_used'
,
array
(
'status'
=>
'1'
),
array
(
'booking_id'
=>
$book_id
));
$bkData
=
$this
->
db
->
query
(
"
SELECT TEVT.event_name,CONCAT(EDATE.date,' ',EDATE.time) AS show_time,
CUST.name,CUST.email,CUST.phone
FROM booking AS BK
INNER JOIN events AS EVT ON (EVT.event_id=BK.event_id)
INNER JOIN translator_event AS TEVT ON (TEVT.event_id=EVT.event_id)
INNER JOIN customer AS CUST ON (CUST.customer_id=BK.customer_id)
INNER JOIN event_date_time AS EDATE ON (EDATE.id=BK.event_date_id)
WHERE BK.bookId='"
.
$trBook
[
'booking_id'
]
.
"' AND EVT.status='1' AND
BK.status='1' AND EDATE.status='1' AND TEVT.language_code='EN'"
)
->
row_array
();
$sql
=
"SELECT TEVT.event_name,CONCAT(EDATE.date,' ',EDATE.time) AS show_time,
CUST.name,CUST.email,CUST.phone,EVT.approve_booking
FROM booking AS BK
INNER JOIN events AS EVT ON (EVT.event_id=BK.event_id)
INNER JOIN translator_event AS TEVT ON (TEVT.event_id=EVT.event_id)
INNER JOIN customer AS CUST ON (CUST.customer_id=BK.customer_id)
INNER JOIN event_date_time AS EDATE ON (EDATE.id=BK.event_date_id)
WHERE BK.bookId='"
.
$trBook
[
'booking_id'
]
.
"' AND EVT.status='1' AND
BK.status='3' AND EDATE.status='1' AND TEVT.language_code='EN'"
;
$bkData
=
$this
->
db
->
query
(
$sql
)
->
row_array
();
$bokStatus
=
'1'
;
if
(
!
empty
(
$bkData
)){
$bokStatus
=
(
isset
(
$bkData
[
'approve_booking'
])
&&
$bkData
[
'approve_booking'
]
==
'1'
)
?
'6'
:
'1'
;
$subject
=
"Your Tickets - TimeOut"
;
$showTime
=
date
(
"d'S F Y - h:i, (l)"
,
strtotime
(
$bkData
[
'show_time'
]));
$msgContent
=
"Hi, Your booking is confirmed for the event '"
.
$bkData
[
'event_name'
]
.
...
...
@@ -1377,13 +1376,15 @@ class Api_model extends CI_Model {
$this
->
send_mail
(
$subject
,
$bkData
[
'email'
],
$message
);
if
(
isset
(
$template
[
'booking_sms'
])
&&
!
empty
(
$template
[
'booking_sms'
])){
$msgContent
=
str_replace
(
array
(
'{:event_name}'
,
'{:booking_id}'
,
'{:time}'
),
array
(
$bkData
[
'event_name'
],
$trBook
[
'booking_id'
],
$showTime
),
$template
[
'booking_sms'
]);
$msgContent
=
str_replace
(
array
(
'{:event_name}'
,
'{:booking_id}'
,
'{:time}'
),
array
(
$bkData
[
'event_name'
],
$trBook
[
'booking_id'
],
$showTime
),
$template
[
'booking_sms'
]);
}
$this
->
sendSMS
(
$bkData
[
'phone'
],
$msgContent
);
}
$this
->
db
->
update
(
'booking'
,
array
(
'status'
=>
$bokStatus
),
array
(
'bookId'
=>
$book_id
));
$this
->
db
->
update
(
'event_invites'
,
array
(
'status'
=>
'1'
),
array
(
'book_id'
=>
$book_id
));
$this
->
db
->
update
(
'promocode_used'
,
array
(
'status'
=>
'1'
),
array
(
'booking_id'
=>
$book_id
));
}
$res
=
array
(
'status'
=>
1
);
}
catch
(
Exception
$e
){
...
...
This diff is collapsed.
Click to expand it.
application/models/Webservice_model.php
View file @
c65d1d6e
...
...
@@ -1061,7 +1061,7 @@ class Webservice_model extends CI_Model {
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$post_data
=
$data
;
$status
=
'3'
;
$book_id
=
'TO'
.
date
(
'ymd'
)
.
str_pad
(
rand
(
1111
,
9999
),
4
,
0
,
STR_PAD_LEFT
);
$post_data
[
'bookId'
]
=
$book_id
;
$post_data
[
'qrcode'
]
=
genQRcode
(
$post_data
[
'bookId'
]);
...
...
@@ -1073,9 +1073,14 @@ class Webservice_model extends CI_Model {
if
(
!
isset
(
$post_data
[
'amount'
])
||
empty
(
$post_data
[
'amount'
])){
$post_data
[
'amount'
]
=
0
;
}
if
(
isset
(
$post_data
[
'has_payment'
])
&&
$post_data
[
'has_payment'
]
==
0
){
$post_data
[
'status'
]
=
'1'
;
$status
=
$post_data
[
'status'
]
=
'1'
;
}
$evtData
=
$this
->
db
->
get_where
(
'events'
,
array
(
'event_id'
=>
$post_data
[
'event_id'
]));
$evtData
=
$evtData
->
row_array
();
if
(
!
empty
(
$evtData
)
&&
isset
(
$evtData
[
'approve_booking'
])
&&
$evtData
[
'approve_booking'
]
==
'1'
){
$post_data
[
'status'
]
=
'6'
;
}
$promocodeData
=
array
();
...
...
@@ -1089,10 +1094,10 @@ class Webservice_model extends CI_Model {
$post_data
[
'amount'
]
=
$post_data
[
'discounted_price'
];
$redeem_amount
=
$post_data
[
'amount'
]
-
$post_data
[
'discounted_price'
];
$
status
=
(
$post_data
[
'status'
]
==
'1'
)
?
1
:
0
;
$
promoStatus
=
(
$post_data
[
'status'
]
==
'1'
)
?
1
:
0
;
$promocodeData
=
array
(
'user_id'
=>
$user_id
,
'booking_id'
=>
$book_id
,
'promocode_id'
=>
$promo_id
,
'redeem_amount'
=>
$redeem_amount
,
'created_date'
=>
date
(
'Y-m-d H:i:s'
),
'status'
=>
$
s
tatus
);
'created_date'
=>
date
(
'Y-m-d H:i:s'
),
'status'
=>
$
promoS
tatus
);
}
$invite_ids
=
(
isset
(
$post_data
[
'friends_ids'
]))
?
$post_data
[
'friends_ids'
]
:
''
;
$invite_phone
=
(
isset
(
$post_data
[
'invite_list'
]))
?
$post_data
[
'invite_list'
]
:
''
;
...
...
@@ -1127,7 +1132,7 @@ class Webservice_model extends CI_Model {
$this
->
db
->
insert_batch
(
'event_invites'
,
$insertArr
);
}
if
(
$
post_data
[
'status'
]
==
1
){
if
(
$
status
==
1
){
$countryData
=
$this
->
getCountryData
(
$user_id
);
$lang
=
$countryData
[
'language_code'
];
...
...
@@ -1197,16 +1202,11 @@ class Webservice_model extends CI_Model {
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$res_count
=
$this
->
db
->
where
(
'bookId'
,
$data
[
'booking_id'
])
->
where
(
'status'
,
1
)
->
get
(
'booking'
)
->
num_rows
();
if
(
$res_count
>
0
)
{
$rs
=
$this
->
db
->
where
(
'bookId'
,
$data
[
'booking_id'
])
->
update
(
'booking'
,
array
(
'status'
=>
0
));
if
(
$rs
)
{
$res
=
array
(
'status'
=>
1
,
'data'
=>
null
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Cancel submission failed'
,
'code'
=>
'ER25'
);
}
$rs
=
$this
->
db
->
where
(
'bookId'
,
$data
[
'booking_id'
])
->
update
(
'booking'
,
array
(
'status'
=>
0
));
if
(
$rs
)
{
$res
=
array
(
'status'
=>
1
,
'data'
=>
null
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'
Invalid booking code'
,
'code'
=>
'ER24
'
);
$res
=
array
(
'status'
=>
0
,
'message'
=>
'
Cancel submission failed'
,
'code'
=>
'ER25
'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Invalid user'
,
'code'
=>
'ER19'
);
...
...
@@ -1374,7 +1374,7 @@ class Webservice_model extends CI_Model {
SELECT BOK.id FROM booking AS BOK
INNER JOIN events AS EVT ON (EVT.event_id=BOK.event_id)
INNER JOIN event_date_time AS EDT ON (EVT.event_id=EVT.event_id)
WHERE BOK.customer_id='
$user_id
' AND BOK.status IN (0,1,2) AND EVT.status='1'
WHERE BOK.customer_id='
$user_id
' AND BOK.status IN (0,1,2
,6
) AND EVT.status='1'
GROUP BY BOK.id"
)
->
num_rows
();
if
(
$count
>
0
)
{
...
...
@@ -1399,7 +1399,7 @@ class Webservice_model extends CI_Model {
INNER JOIN event_date_time ON booking.event_date_id = event_date_time.id
INNER JOIN venue ON venue.id = events.venue_id
INNER JOIN translator_event ON translator_event.event_id = events.event_id
WHERE booking.customer_id = '
$user_id
' AND booking.status IN(0,
1, 2
) AND
WHERE booking.customer_id = '
$user_id
' AND booking.status IN(0,
1,2,6
) AND
(translator_event.language_code='
$lang
' OR translator_event.language_code='EN')
GROUP BY booking.id
ORDER BY booking.id DESC
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment