Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
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
hujun
tl_estate
Commits
6614b0dd
Commit
6614b0dd
authored
Jun 03, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
城市地铁
parent
dd05ef6a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
1 deletion
+121
-1
Station.php
application/index/controller/Station.php
+51
-0
StationService.php
application/index/service/StationService.php
+67
-0
MetroStations.php
application/model/MetroStations.php
+1
-1
route.php
application/route.php
+2
-0
No files found.
application/index/controller/Station.php
0 → 100644
View file @
6614b0dd
<?php
/**
* Created by PhpStorm.
* User: HuJun
* Date: 2019/6/3
* Time: 15:23
*/
namespace
app\index\controller
;
use
app\index\extend\Basic
;
use
app\index\service\StationService
;
class
Station
extends
Basic
{
private
$station_service
;
private
$code
=
200
;
private
$msg
=
''
;
private
$data
=
[];
public
function
__construct
()
{
parent
::
__construct
();
$this
->
station_service
=
new
StationService
();
}
/**
* 城市地铁
*
* @return \think\Response
*/
public
function
getList
()
{
$code
=
200
;
$msg
=
''
;
$data
=
[];
$result
=
$this
->
station_service
->
getStationList
(
$this
->
params
);
if
(
$result
[
'status'
]
==
'successful'
)
{
$data
=
$result
[
'data'
];
}
else
{
$code
=
101
;
$msg
=
$result
[
'msg'
];
}
return
$this
->
response
(
$code
,
$msg
,
$data
);
}
}
\ No newline at end of file
application/index/service/StationService.php
0 → 100644
View file @
6614b0dd
<?php
/**
* Created by PhpStorm.
* User: HuJun
* Date: 2019/6/3
* Time: 15:25
*/
namespace
app\index\service
;
use
app\model\MetroStations
;
class
StationService
{
private
$m_metro_stations
;
public
function
__construct
()
{
$this
->
m_metro_stations
=
new
MetroStations
();
}
/**
* 当前城市地铁
*
* @param $params
* @return mixed
*/
public
function
getStationList
(
$params
)
{
$result
[
'status'
]
=
'fail'
;
if
(
empty
(
$params
[
'province'
]))
{
$result
[
'msg'
]
=
'省为空'
;
return
$result
;
}
if
(
empty
(
$params
[
'city'
]))
{
$result
[
'msg'
]
=
'市为空'
;
return
$result
;
}
$where
[
'province'
]
=
$params
[
'province'
];
$where
[
'city'
]
=
$params
[
'city'
];
$field
=
'id,line_name_simple,name,latitude,longitude'
;
try
{
$data
=
$this
->
m_metro_stations
->
getListAll
(
$field
,
$where
);
}
catch
(
\Exception
$e
)
{
$result
[
'msg'
]
=
$e
->
getMessage
();
return
$result
;
}
$line_name
=
[];
foreach
(
$data
as
$k
=>
$v
)
{
$line_name
[
$v
[
'line_name_simple'
]][]
=
[
'id'
=>
$v
[
'id'
],
'name'
=>
$v
[
'name'
],
'latitude'
=>
$v
[
'latitude'
],
'longitude'
=>
$v
[
'longitude'
],
];
}
$result
[
'status'
]
=
'successful'
;
$result
[
'data'
]
=
$line_name
;
return
$result
;
}
}
\ No newline at end of file
application/model/MetroStations.php
View file @
6614b0dd
...
...
@@ -42,7 +42,7 @@ class MetroStations extends BaseModel
*/
public
function
getListAll
(
$field
,
$where
)
{
$where
[
'i
mg_status
'
]
=
0
;
$where
[
'i
s_del
'
]
=
0
;
return
$this
->
db_
->
field
(
$field
)
->
where
(
$where
)
->
select
();
...
...
application/route.php
View file @
6614b0dd
...
...
@@ -986,6 +986,7 @@ Route::group('office_index', [
'getBuildingList'
=>
[
'index/OfficeManage/getBuildingList'
,
[
'method'
=>
'GET'
]],
//楼盘列表
'delBuilding'
=>
[
'index/OfficeManage/delBuilding'
,
[
'method'
=>
'GET'
]],
//删除楼盘
'getRoomList'
=>
[
'index/OfficeRoom/getRoomList'
,
[
'method'
=>
'GET'
]],
//删除楼盘
'getList'
=>
[
'index/Station/getList'
,
[
'method'
=>
'GET'
]],
//城市地铁
]);
//Route::miss('api/index/miss');//处理错误的url
\ No newline at end of file
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