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
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
38 deletions
+91
-38
Api.php
application/controllers/Api.php
+8
-3
bookingStatusCrone.php
application/controllers/bookingStatusCrone.php
+3
-0
Api_model.php
application/models/Api_model.php
+34
-7
Webservice_model.php
application/models/Webservice_model.php
+46
-28
No files found.
application/controllers/Api.php
View file @
f4723d25
...
...
@@ -329,6 +329,10 @@ class Api extends CI_Controller {
switch
(
$txnType
){
case
'WALLET'
:
return
$this
->
Api_model
->
updateWalletTxn
(
$txnData
);
case
'HOTEL_BOOK'
:
if
(
isset
(
$txnData
[
'bookData'
])
&&
!
empty
(
$txnData
[
'bookData'
])){
return
$this
->
Api_model
->
hotelBooking
(
$txnData
);
}
}
}
...
...
@@ -349,8 +353,9 @@ class Api extends CI_Controller {
}
if
(
isset
(
$reqData
[
'txnType'
])
&&
!
empty
(
$reqData
[
'txnType'
])){
$params
=
array
(
'mode'
=>
'1'
,
'status'
=>
'0'
,
'auth_token'
=>
$reqData
[
'auth_token'
],
'amount'
=>
$reqData
[
'amount'
]);
$params
=
array
(
'mode'
=>
'1'
,
'status'
=>
'0'
,
'auth_token'
=>
$reqData
[
'auth_token'
],
'amount'
=>
$reqData
[
'amount'
],
'bookData'
=>
(
isset
(
$reqData
[
'bookData'
]))
?
$reqData
[
'bookData'
]
:
''
);
$customData
=
$this
->
txnManager
(
$reqData
[
'txnType'
],
$params
);
if
(
empty
(
$customData
)){
...
...
@@ -577,7 +582,7 @@ class Api extends CI_Controller {
$eventid
=
$data
[
2
];
$booking_id
=
$data
[
3
];
$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
INNER JOIN booking AS BOK ON (BOK.bookId=TX.booking_id)
...
...
application/controllers/bookingStatusCrone.php
View file @
f4723d25
...
...
@@ -25,5 +25,8 @@
WHERE transaction.datetime<'
$date_time
'"
;
mysqli_query
(
$conn
,
$sql
);
$sql
=
"UPDATE wallet_transactions SET status='2' WHERE status='0' && created_date<'
$date_time
'"
;
mysqli_query
(
$conn
,
$sql
);
$conn
->
close
();
?>
application/models/Api_model.php
View file @
f4723d25
...
...
@@ -627,6 +627,7 @@ class Api_model extends CI_Model {
'created_date'
=>
date
(
'Y-m-d H:i:s'
),
'status'
=>
$promoStatus
);
}
$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'
],
$post_data
[
'promocode_id'
],
$post_data
[
'redeem_amount'
]);
...
...
@@ -636,13 +637,11 @@ class Api_model extends CI_Model {
$this
->
db
->
insert
(
'promocode_used'
,
$promocodeData
);
}
$cardDetails
=
array
();
if
(
isset
(
$post_data
[
'cardData'
])
&&
!
empty
(
$card_data
=
$post_data
[
'cardData'
])){
// (CC)-Credit ,(DC)-Debit ,(DD)-Direct Debit,(PAYPAL)-PayPal,(NB)-Net Banking
if
(
!
empty
(
$card_data
)){
switch
(
$card_data
->
card_type
)
{
case
'1'
:
$cardDetails
[
'cardMode'
]
=
'CC'
;
break
;
case
'2'
:
$cardDetails
[
'cardMode'
]
=
'DC'
;
break
;
case
'3'
:
$cardDetails
[
'cardMode'
]
=
'DD'
;
break
;
default
:
$cardDetails
[
'cardMode'
]
=
'DD'
;
break
;
case
'1'
:
$cardDetails
[
'cardMode'
]
=
'DD'
;
break
;
case
'2'
:
$cardDetails
[
'cardMode'
]
=
'CC'
;
break
;
default
:
$cardDetails
[
'cardMode'
]
=
'CC'
;
break
;
}
switch
(
substr
(
$card_data
->
card_number
,
0
,
1
))
{
...
...
@@ -1397,7 +1396,7 @@ class Api_model extends CI_Model {
array
(
'transaction_code'
=>
$txnData
[
'tnx_id'
]));
if
(
$txnData
[
'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'
];
$customer_id
=
$lastTxn
[
'customer_id'
];
...
...
@@ -1791,5 +1790,32 @@ class Api_model extends CI_Model {
$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 {
if
(
empty
(
$data
)){
return
array
(
'status'
=>
0
,
'code'
=>
'918'
,
'message'
=>
'Data Missing'
);
}
$phNumbers
=
''
;
foreach
(
$data
[
'contacts'
]
AS
$key
=>
$number
)
{
$number
=
preg_replace
(
'/\D/'
,
''
,
$number
);
...
...
@@ -1875,40 +1876,63 @@ class Webservice_model extends CI_Model {
$phNumbers
.=
" (CUST.phone LIKE '%"
.
$number
.
"' "
.
$eCond
;
}
}
if
(
empty
(
$phNumbers
)){
return
array
(
'status'
=>
0
,
'code'
=>
'919'
,
'message'
=>
'Invalid Data'
);
}
if
(
empty
(
$phNumbers
)){
return
array
(
'status'
=>
0
,
'code'
=>
'919'
,
'message'
=>
'Invalid Data'
);
}
$sql
=
"SELECT CUST.customer_id FROM customer AS CUST
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
();
if
(
empty
(
$custIds
)){
return
array
(
'status'
=>
0
,
'code'
=>
'919'
,
'message'
=>
'No Data Found'
);
}
$user_ids
=
''
;
foreach
(
$custIds
AS
$id
)
{
$user_ids
=
$id
[
'customer_id'
]
.
','
;
if
(
!
empty
(
$user_ids
)
&&
in_array
(
$id
,
$user_ids
)){
continue
;
}
$user_ids
[]
=
$id
[
'customer_id'
];
}
$sql
=
"SELECT from_user FROM chats
WHERE (from_user=
$user_id
AND type='2') OR (to_user=
$user_id
AND type='2')"
;
$blocked
=
$this
->
db
->
query
(
$sql
)
->
result_array
();
if
(
!
empty
(
$blocked
)){
foreach
(
$blocked
AS
$id
)
{
$user_ids
=
array_diff
(
$user_ids
,
$id
);
}
}
$sql
=
"SELECT to_user FROM chats
WHERE (from_user=
$user_id
AND type='2') OR (to_user=
$user_id
AND type='2')"
;
$blocked
=
$this
->
db
->
query
(
$sql
)
->
result_array
();
if
(
!
empty
(
$blocked
)){
foreach
(
$blocked
AS
$id
)
{
$user_ids
=
array_diff
(
$user_ids
,
$id
);
}
}
$user_ids
=
trim
(
$user_ids
,
','
);
$result
=
$this
->
db
->
query
(
"SELECT CUST.customer_id,CUST.name,CUST.phone,CUST.profile_image,
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 ((CUST.customer_id=CHT.from_user OR CUST.customer_id=CHT.to_user) AND CHT.type IN (0,1))
WHERE CUST.customer_id IN (
$user_ids
) AND
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'))
AND
customer_id NOT IN
(SELECT to_user FROM chats
WHERE (from_user=
$user_id
AND type='2') OR
(to_user=
$user_id
AND type='2'))
GROUP BY CUST.customer_id"
);
$respArr
[
'status'
]
=
1
;
$respArr
[
'data'
]
=
(
!
empty
(
$result
)
&&
!
empty
(
$result
=
$result
->
result_array
()))
?
$result
:
[];
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
;
}
...
...
@@ -1978,16 +2002,10 @@ class Webservice_model extends CI_Model {
public
function
recent_chats
(
$data
){
$respArr
=
array
(
'status'
=>
0
,
'code'
=>
'918'
,
'message'
=>
'No Request for you'
);
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
$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 ('0','1')"
)
->
result_array
();
$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
();
$custData
=
array
();
if
(
!
empty
(
$result
)){
foreach
(
$result
as
$key
=>
$value
)
{
if
(
$value
[
'type'
]
==
0
){
continue
;
}
$fromUsrId
=
''
;
if
(
$value
[
'to_user'
]
==
$user_id
)
{
$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