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
3bfd1da0
Commit
3bfd1da0
authored
Nov 05, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trawex hotel list api
parent
51e6e25b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
2 deletions
+58
-2
Webservice.php
application/controllers/Webservice.php
+11
-0
Validation_app_model.php
application/models/Validation_app_model.php
+8
-0
Webservice_model.php
application/models/Webservice_model.php
+39
-2
No files found.
application/controllers/Webservice.php
View file @
3bfd1da0
...
...
@@ -581,5 +581,16 @@ class Webservice extends CI_Controller {
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
hotel_search
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
hotel_search
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
}
?>
application/models/Validation_app_model.php
View file @
3bfd1da0
...
...
@@ -170,6 +170,14 @@ class Validation_app_model extends CI_Model {
)
),
'get_hotel_city_list'
=>
array
(),
'hotel_search'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User id is null or empty'
)
)
)
);
public
function
validation_check
(
$method_name
,
$parms
)
{
...
...
application/models/Webservice_model.php
View file @
3bfd1da0
...
...
@@ -2045,7 +2045,7 @@ class Webservice_model extends CI_Model {
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$cond
=
''
;
if
(
isset
(
$data
[
'query'
])
&&
empty
(
$data
[
'query'
])){
if
(
isset
(
$data
[
'query'
])
&&
!
empty
(
$data
[
'query'
])){
$cond
=
"AND THC.hotel_city_name LIKE '%"
.
$data
[
'query'
]
.
"%'"
;
}
$sql
=
"SELECT HC.hotel_city_id FROM hotel_cities AS HC
...
...
@@ -2061,7 +2061,7 @@ class Webservice_model extends CI_Model {
$sql
=
"SELECT THC.hotel_city_id AS id,HC.hotel_city_icon AS image
FROM translator_hotel_city AS THC
INNER JOIN hotel_cities AS HC ON (HC.hotel_city_id=THC.hotel_city_id)
WHERE THC.status=1
$cond
LIMIT
$limit
,
$perPage
"
;
WHERE THC.status=1
$cond
GROUP BY HC.hotel_city_id
LIMIT
$limit
,
$perPage
"
;
$hotelData
=
$this
->
db
->
query
(
$sql
)
->
result_array
();
$countryData
=
$this
->
getCountryData
(
$user_id
);
...
...
@@ -2087,5 +2087,42 @@ class Webservice_model extends CI_Model {
}
return
$res
;
}
public
function
hotel_search
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$trackingId
=
time
()
.
rand
(
100000
,
999999
);
$settings
=
getSettings
();
if
(
!
isset
(
$data
[
'nextToken'
])
&&
empty
(
$data
[
'nextToken'
])){
$this
->
db
->
select
(
'nationality'
);
$userData
=
$this
->
db
->
get_where
(
'customer'
,
array
(
'customer_id'
=>
$user_id
))
->
row_array
();
$countryData
=
$this
->
getCountryData
(
$user_id
);
}
$url
=
(
isset
(
$data
[
'nextToken'
])
&&
!
empty
(
$data
[
'nextToken'
]))
?
"https://trawex.biz/api/hotel_trawexv5/getMoreHotels?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&sessionId="
.
$data
[
'sessionId'
]
.
"&nextToken="
.
$data
[
'nextToken'
]
.
"&trackingId="
.
$data
[
'trackingId'
]
.
""
:
"https://trawex.biz/api/hotel_trawexv5/hotel_search"
;
$postFields
=
(
isset
(
$data
[
'nextToken'
])
&&
!
empty
(
$data
[
'nextToken'
]))
?
''
:
json_encode
(
array
(
'user_id'
=>
$settings
[
'trawex_user_id'
],
'user_password'
=>
$settings
[
'trawex_user_password'
],
'access'
=>
$settings
[
'trawex_access'
],
'ip_address'
=>
$settings
[
'trawex_ip_address'
],
'trackingId'
=>
$trackingId
,
'city_name'
=>
$data
[
'city_name'
],
'country_name'
=>
(
!
empty
(
$userData
[
'nationality'
]))
?
$userData
[
'nationality'
]
:
''
,
'room_count'
=>
$data
[
'room_count'
],
'adult'
=>
$data
[
'adult'
],
'child'
=>
$data
[
'child'
],
'child_age'
=>
$data
[
'child_age'
],
'checkin'
=>
$data
[
'checkin'
],
'checkout'
=>
$data
[
'checkout'
],
'client_nationality'
=>
$countryData
[
'country_code'
],
'requiredCurrency'
=>
$countryData
[
'currency'
]));
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$postFields
);
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYHOST
,
false
);
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYPEER
,
false
);
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
array
(
'Content-Type:application/json'
));
$result
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
$result
=
json_decode
(
$result
);
$result
->
status
->
trackingId
=
(
!
isset
(
$data
[
'nextToken'
])
&&
empty
(
$data
[
'nextToken'
]))
?
$trackingId
:
$data
[
'trackingId'
];
$res
=
array
(
'status'
=>
1
,
'data'
=>
array
(
'itineraries'
=>
$result
));
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
}
?>
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