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
f4723d25
Commit
f4723d25
authored
Dec 09, 2019
by
Tobin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'dev_production'
Master See merge request
!231
parents
34b3bea0
c609a986
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
99 additions
and
46 deletions
+99
-46
Api.php
application/controllers/Api.php
+9
-4
bookingStatusCrone.php
application/controllers/bookingStatusCrone.php
+3
-0
Api_model.php
application/models/Api_model.php
+35
-8
Webservice_model.php
application/models/Webservice_model.php
+52
-34
No files found.
application/controllers/Api.php
View file @
f4723d25
...
@@ -329,6 +329,10 @@ class Api extends CI_Controller {
...
@@ -329,6 +329,10 @@ class Api extends CI_Controller {
switch
(
$txnType
){
switch
(
$txnType
){
case
'WALLET'
:
case
'WALLET'
:
return
$this
->
Api_model
->
updateWalletTxn
(
$txnData
);
return
$this
->
Api_model
->
updateWalletTxn
(
$txnData
);
case
'HOTEL_BOOK'
:
if
(
isset
(
$txnData
[
'bookData'
])
&&
!
empty
(
$txnData
[
'bookData'
])){
return
$this
->
Api_model
->
hotelBooking
(
$txnData
);
}
}
}
}
}
...
@@ -345,12 +349,13 @@ class Api extends CI_Controller {
...
@@ -345,12 +349,13 @@ class Api extends CI_Controller {
if
(
empty
(
$reqData
)
||
empty
(
$reqData
=
json_decode
(
$reqData
,
true
))
||
if
(
empty
(
$reqData
)
||
empty
(
$reqData
=
json_decode
(
$reqData
,
true
))
||
!
isset
(
$reqData
[
'amount'
])
||
empty
(
$amount
=
$reqData
[
'amount'
])
||
!
isset
(
$reqData
[
'amount'
])
||
empty
(
$amount
=
$reqData
[
'amount'
])
||
!
isset
(
$reqData
[
'auth_token'
])
||
empty
(
$auth_token
=
$reqData
[
'auth_token'
])){
!
isset
(
$reqData
[
'auth_token'
])
||
empty
(
$auth_token
=
$reqData
[
'auth_token'
])){
redirect
(
$redUrl
.
'failure'
);
redirect
(
$redUrl
.
'failure'
);
}
}
if
(
isset
(
$reqData
[
'txnType'
])
&&
!
empty
(
$reqData
[
'txnType'
])){
if
(
isset
(
$reqData
[
'txnType'
])
&&
!
empty
(
$reqData
[
'txnType'
])){
$params
=
array
(
'mode'
=>
'1'
,
'status'
=>
'0'
,
'auth_token'
=>
$reqData
[
'auth_token'
],
$params
=
array
(
'mode'
=>
'1'
,
'status'
=>
'0'
,
'amount'
=>
$reqData
[
'amount'
]);
'auth_token'
=>
$reqData
[
'auth_token'
],
'amount'
=>
$reqData
[
'amount'
],
'bookData'
=>
(
isset
(
$reqData
[
'bookData'
]))
?
$reqData
[
'bookData'
]
:
''
);
$customData
=
$this
->
txnManager
(
$reqData
[
'txnType'
],
$params
);
$customData
=
$this
->
txnManager
(
$reqData
[
'txnType'
],
$params
);
if
(
empty
(
$customData
)){
if
(
empty
(
$customData
)){
...
@@ -577,7 +582,7 @@ class Api extends CI_Controller {
...
@@ -577,7 +582,7 @@ class Api extends CI_Controller {
$eventid
=
$data
[
2
];
$eventid
=
$data
[
2
];
$booking_id
=
$data
[
3
];
$booking_id
=
$data
[
3
];
$this
->
Api_model
->
update_payment
(
$response
,
''
,
$last_id
,
'0'
,
$eventid
);
$this
->
Api_model
->
update_payment
(
$response
,
''
,
$last_id
,
'0'
,
$eventid
);
$customData
=
$this
->
txnManager
(
$eventid
,
array
(
'tnx_id'
=>
$booking_id
,
'status'
=>
'
0
'
));
$customData
=
$this
->
txnManager
(
$eventid
,
array
(
'tnx_id'
=>
$booking_id
,
'status'
=>
'
2
'
));
$sql
=
"SELECT BOK.event_id FROM transaction AS TX
$sql
=
"SELECT BOK.event_id FROM transaction AS TX
INNER JOIN booking AS BOK ON (BOK.bookId=TX.booking_id)
INNER JOIN booking AS BOK ON (BOK.bookId=TX.booking_id)
...
...
application/controllers/bookingStatusCrone.php
View file @
f4723d25
...
@@ -25,5 +25,8 @@
...
@@ -25,5 +25,8 @@
WHERE transaction.datetime<'
$date_time
'"
;
WHERE transaction.datetime<'
$date_time
'"
;
mysqli_query
(
$conn
,
$sql
);
mysqli_query
(
$conn
,
$sql
);
$sql
=
"UPDATE wallet_transactions SET status='2' WHERE status='0' && created_date<'
$date_time
'"
;
mysqli_query
(
$conn
,
$sql
);
$conn
->
close
();
$conn
->
close
();
?>
?>
application/models/Api_model.php
View file @
f4723d25
...
@@ -627,6 +627,7 @@ class Api_model extends CI_Model {
...
@@ -627,6 +627,7 @@ class Api_model extends CI_Model {
'created_date'
=>
date
(
'Y-m-d H:i:s'
),
'status'
=>
$promoStatus
);
'created_date'
=>
date
(
'Y-m-d H:i:s'
),
'status'
=>
$promoStatus
);
}
}
$auth_token
=
$post_data
[
'auth_token'
];
$auth_token
=
$post_data
[
'auth_token'
];
$card_data
=
(
isset
(
$post_data
[
'cardData'
]))
?
$post_data
[
'cardData'
]
:
array
();
unset
(
$post_data
[
'auth_token'
],
$post_data
[
'has_payment'
],
$post_data
[
'cardData'
],
unset
(
$post_data
[
'auth_token'
],
$post_data
[
'has_payment'
],
$post_data
[
'cardData'
],
$post_data
[
'promocode_id'
],
$post_data
[
'redeem_amount'
]);
$post_data
[
'promocode_id'
],
$post_data
[
'redeem_amount'
]);
...
@@ -636,13 +637,11 @@ class Api_model extends CI_Model {
...
@@ -636,13 +637,11 @@ class Api_model extends CI_Model {
$this
->
db
->
insert
(
'promocode_used'
,
$promocodeData
);
$this
->
db
->
insert
(
'promocode_used'
,
$promocodeData
);
}
}
$cardDetails
=
array
();
$cardDetails
=
array
();
if
(
isset
(
$post_data
[
'cardData'
])
&&
!
empty
(
$card_data
=
$post_data
[
'cardData'
])){
if
(
!
empty
(
$card_data
)){
// (CC)-Credit ,(DC)-Debit ,(DD)-Direct Debit,(PAYPAL)-PayPal,(NB)-Net Banking
switch
(
$card_data
->
card_type
)
{
switch
(
$card_data
->
card_type
)
{
case
'1'
:
$cardDetails
[
'cardMode'
]
=
'CC'
;
break
;
case
'1'
:
$cardDetails
[
'cardMode'
]
=
'DD'
;
break
;
case
'2'
:
$cardDetails
[
'cardMode'
]
=
'DC'
;
break
;
case
'2'
:
$cardDetails
[
'cardMode'
]
=
'CC'
;
break
;
case
'3'
:
$cardDetails
[
'cardMode'
]
=
'DD'
;
break
;
default
:
$cardDetails
[
'cardMode'
]
=
'CC'
;
break
;
default
:
$cardDetails
[
'cardMode'
]
=
'DD'
;
break
;
}
}
switch
(
substr
(
$card_data
->
card_number
,
0
,
1
))
{
switch
(
substr
(
$card_data
->
card_number
,
0
,
1
))
{
...
@@ -1397,8 +1396,8 @@ class Api_model extends CI_Model {
...
@@ -1397,8 +1396,8 @@ class Api_model extends CI_Model {
array
(
'transaction_code'
=>
$txnData
[
'tnx_id'
]));
array
(
'transaction_code'
=>
$txnData
[
'tnx_id'
]));
if
(
$txnData
[
'status'
]
==
1
){
if
(
$txnData
[
'status'
]
==
1
){
$cond
=
array
(
'transaction_code'
=>
$txnData
[
'tnx_id'
],
'status'
=>
'1'
);
$cond
=
array
(
'transaction_code'
=>
$txnData
[
'tnx_id'
],
'status'
=>
'1'
);
$lastTxn
=
$this
->
db
->
get_where
(
'wallet_transactions'
,
$cond
)
->
r
esult
_array
();
$lastTxn
=
$this
->
db
->
get_where
(
'wallet_transactions'
,
$cond
)
->
r
ow
_array
();
$amount
=
$lastTxn
[
'amount'
];
$amount
=
$lastTxn
[
'amount'
];
$customer_id
=
$lastTxn
[
'customer_id'
];
$customer_id
=
$lastTxn
[
'customer_id'
];
$sql
=
"UPDATE wallet SET balance_amount=balance_amount+
$amount
$sql
=
"UPDATE wallet SET balance_amount=balance_amount+
$amount
...
@@ -1791,5 +1790,32 @@ class Api_model extends CI_Model {
...
@@ -1791,5 +1790,32 @@ class Api_model extends CI_Model {
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Invalid user'
,
'code'
=>
'ER19'
);
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Invalid user'
,
'code'
=>
'ER19'
);
}
}
}
}
public
function
hotelBooking
(
$txnData
=
array
()){
try
{
if
(
empty
(
$txnData
)){
return
;
}
if
(
$txnData
[
'status'
]
==
'0'
){
if
(
!
isset
(
$txnData
[
'mode'
])
||
empty
(
$txnData
[
'mode'
])
||
!
isset
(
$txnData
[
'amount'
])
||
empty
(
$txnData
[
'amount'
])
||
!
isset
(
$txnData
[
'auth_token'
])
||
empty
(
$txnData
[
'auth_token'
])
||
!
isset
(
$txnData
[
'bookData'
])
||
empty
(
$bookData
=
$txnData
[
'bookData'
])){
return
;
}
$user_id
=
$this
->
auth_token_get
(
$txnData
[
'auth_token'
]);
if
(
empty
(
$user_id
)){
return
;
}
$bookId
=
'HTL'
.
date
(
'ymd'
)
.
str_pad
(
rand
(
1111
,
9999
),
4
,
0
,
STR_PAD_LEFT
);
$insert
=
array
(
'hotel_book_id'
=>
$bookId
,
'hotel_name'
=>
$bookData
[
'hotelName'
],
'hotel_image'
=>
$bookData
[
'hotelImage'
],
'checkin'
=>
$bookData
[
'checkin'
],
'checkout'
=>
$bookData
[
'checkout'
],
'price'
=>
$bookData
[
'amount'
],
'request_data'
=>
json_encode
(
$bookData
[
'requestData'
]));
$this
->
db
->
insert
(
'hotel_booking'
,
$insert
);
return
array
(
'status'
=>
1
,
'transaction_id'
=>
$bookId
);
}
}
catch
(
Exception
$e
){}
}
}
}
?>
?>
\ No newline at end of file
application/models/Webservice_model.php
View file @
f4723d25
...
@@ -1863,6 +1863,7 @@ class Webservice_model extends CI_Model {
...
@@ -1863,6 +1863,7 @@ class Webservice_model extends CI_Model {
if
(
empty
(
$data
)){
if
(
empty
(
$data
)){
return
array
(
'status'
=>
0
,
'code'
=>
'918'
,
'message'
=>
'Data Missing'
);
return
array
(
'status'
=>
0
,
'code'
=>
'918'
,
'message'
=>
'Data Missing'
);
}
}
$phNumbers
=
''
;
$phNumbers
=
''
;
foreach
(
$data
[
'contacts'
]
AS
$key
=>
$number
)
{
foreach
(
$data
[
'contacts'
]
AS
$key
=>
$number
)
{
$number
=
preg_replace
(
'/\D/'
,
''
,
$number
);
$number
=
preg_replace
(
'/\D/'
,
''
,
$number
);
...
@@ -1875,40 +1876,63 @@ class Webservice_model extends CI_Model {
...
@@ -1875,40 +1876,63 @@ class Webservice_model extends CI_Model {
$phNumbers
.=
" (CUST.phone LIKE '%"
.
$number
.
"' "
.
$eCond
;
$phNumbers
.=
" (CUST.phone LIKE '%"
.
$number
.
"' "
.
$eCond
;
}
}
}
}
if
(
empty
(
$phNumbers
)){
if
(
empty
(
$phNumbers
)){
return
array
(
'status'
=>
0
,
'code'
=>
'919'
,
'message'
=>
'Invalid Data'
);
}
return
array
(
'status'
=>
0
,
'code'
=>
'919'
,
'message'
=>
'Invalid Data'
);
}
$sql
=
"SELECT CUST.customer_id FROM customer AS CUST
$sql
=
"SELECT CUST.customer_id FROM customer AS CUST
INNER JOIN users AS USR ON (USR.id=CUST.customer_id)
INNER JOIN users AS USR ON (USR.id=CUST.customer_id)
WHERE
$phNumbers
AND CUST.customer_id!=
$user_id
"
;
WHERE
CUST.enable_chat='1' AND CUST.customer_id!=
$user_id
AND
$phNumbers
"
;
$custIds
=
$this
->
db
->
query
(
$sql
)
->
result_array
();
$custIds
=
$this
->
db
->
query
(
$sql
)
->
result_array
();
if
(
empty
(
$custIds
)){
if
(
empty
(
$custIds
)){
return
array
(
'status'
=>
0
,
'code'
=>
'919'
,
'message'
=>
'No Data Found'
);
return
array
(
'status'
=>
0
,
'code'
=>
'919'
,
'message'
=>
'No Data Found'
);
}
}
$user_ids
=
''
;
$user_ids
=
''
;
foreach
(
$custIds
AS
$id
)
{
foreach
(
$custIds
AS
$id
)
{
$user_ids
=
$id
[
'customer_id'
]
.
','
;
if
(
!
empty
(
$user_ids
)
&&
in_array
(
$id
,
$user_ids
)){
continue
;
}
$user_ids
[]
=
$id
[
'customer_id'
];
}
}
$user_ids
=
trim
(
$user_ids
,
','
);
$sql
=
"SELECT from_user FROM chats
$result
=
$this
->
db
->
query
(
"SELECT CUST.customer_id,CUST.name,CUST.phone,CUST.profile_image,
WHERE (from_user=
$user_id
AND type='2') OR (to_user=
$user_id
AND type='2')"
;
CUST.profile_image_qr,CHT.type AS friend_status
$blocked
=
$this
->
db
->
query
(
$sql
)
->
result_array
();
FROM customer AS CUST
if
(
!
empty
(
$blocked
)){
LEFT JOIN chats AS CHT ON ((CUST.customer_id=CHT.from_user OR CUST.customer_id=CHT.to_user) AND CHT.type IN (0,1))
foreach
(
$blocked
AS
$id
)
{
WHERE CUST.customer_id IN (
$user_ids
) AND
$user_ids
=
array_diff
(
$user_ids
,
$id
);
customer_id NOT IN
}
(SELECT from_user FROM chats
}
WHERE (from_user=
$user_id
AND type='2') OR
(to_user=
$user_id
AND type='2'))
$sql
=
"SELECT to_user FROM chats
AND
WHERE (from_user=
$user_id
AND type='2') OR (to_user=
$user_id
AND type='2')"
;
customer_id NOT IN
$blocked
=
$this
->
db
->
query
(
$sql
)
->
result_array
();
(SELECT to_user FROM chats
if
(
!
empty
(
$blocked
)){
WHERE (from_user=
$user_id
AND type='2') OR
foreach
(
$blocked
AS
$id
)
{
(to_user=
$user_id
AND type='2'))
$user_ids
=
array_diff
(
$user_ids
,
$id
);
GROUP BY CUST.customer_id"
);
}
$respArr
[
'status'
]
=
1
;
}
$respArr
[
'data'
]
=
(
!
empty
(
$result
)
&&
!
empty
(
$result
=
$result
->
result_array
()))
?
$result
:
[];
if
(
empty
(
$user_ids
)){
return
array
(
'status'
=>
0
,
'code'
=>
'920'
,
'message'
=>
'No User Found'
);
}
$chatUsers
=
array
();
foreach
(
$user_ids
AS
$user
)
{
$sql
=
"SELECT CUST.customer_id,CUST.name,CUST.phone,CUST.profile_image,
CUST.profile_image_qr,CHT.type AS friend_status
FROM customer AS CUST
LEFT JOIN chats AS CHT ON (
((CHT.from_user=
$user
AND to_user=
$user_id
) OR
(CHT.to_user=
$user
AND from_user=
$user_id
)) AND
CHT.type IN (0,1))
WHERE CUST.customer_id IN (
$user
)
GROUP BY CUST.customer_id"
;
$result
=
$this
->
db
->
query
(
$sql
)
->
row_array
();
if
(
!
empty
(
$result
)){
$chatUsers
[]
=
$result
;
}
}
$respArr
=
array
(
'status'
=>
1
,
'data'
=>
$chatUsers
);
return
$respArr
;
return
$respArr
;
}
}
...
@@ -1978,16 +2002,10 @@ class Webservice_model extends CI_Model {
...
@@ -1978,16 +2002,10 @@ class Webservice_model extends CI_Model {
public
function
recent_chats
(
$data
){
public
function
recent_chats
(
$data
){
$respArr
=
array
(
'status'
=>
0
,
'code'
=>
'918'
,
'message'
=>
'No Request for you'
);
$respArr
=
array
(
'status'
=>
0
,
'code'
=>
'918'
,
'message'
=>
'No Request for you'
);
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
$result
=
$this
->
db
->
query
(
"SELECT from_user,to_user,type
$result
=
$this
->
db
->
query
(
"SELECT from_user,to_user,type FROM chats WHERE (from_user=
$user_id
OR to_user=
$user_id
) AND type IN ('1')"
)
->
result_array
();
FROM chats
WHERE (from_user=
$user_id
OR to_user=
$user_id
) AND
type IN ('0','1')"
)
->
result_array
();
$custData
=
array
();
$custData
=
array
();
if
(
!
empty
(
$result
)){
if
(
!
empty
(
$result
)){
foreach
(
$result
as
$key
=>
$value
)
{
foreach
(
$result
as
$key
=>
$value
)
{
if
(
$value
[
'type'
]
==
0
){
continue
;
}
$fromUsrId
=
''
;
$fromUsrId
=
''
;
if
(
$value
[
'to_user'
]
==
$user_id
)
{
if
(
$value
[
'to_user'
]
==
$user_id
)
{
$fromUsrId
=
$value
[
'from_user'
];
$fromUsrId
=
$value
[
'from_user'
];
...
...
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