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
dab364f3
Commit
dab364f3
authored
May 30, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量获取地铁站经纬度
parent
09cbf120
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
2 deletions
+67
-2
BatchProcessing.php
application/index/controller/BatchProcessing.php
+47
-0
MetroStations.php
application/model/MetroStations.php
+17
-0
route.php
application/route.php
+3
-2
No files found.
application/index/controller/BatchProcessing.php
View file @
dab364f3
...
@@ -5,6 +5,7 @@ namespace app\index\controller;
...
@@ -5,6 +5,7 @@ namespace app\index\controller;
use
app\index\extend\Basic
;
use
app\index\extend\Basic
;
use
app\index\service\HouseService
;
use
app\index\service\HouseService
;
use
app\model\GBusinessDistrict
;
use
app\model\GBusinessDistrict
;
use
app\model\MetroStations
;
use
think\Log
;
use
think\Log
;
/**
/**
...
@@ -65,6 +66,52 @@ class BatchProcessing extends Basic
...
@@ -65,6 +66,52 @@ class BatchProcessing extends Basic
return
$this
->
response
(
"200"
,
"处理完成"
,[
'成功数'
=>
$success_num
,
'失败数'
=>
$fail
]);
return
$this
->
response
(
"200"
,
"处理完成"
,[
'成功数'
=>
$success_num
,
'失败数'
=>
$fail
]);
}
}
/**
* 批量获取地铁站经纬度
* @return \think\Response
*/
public
function
getMetroStationsLatAadLng
(){
$model
=
new
MetroStations
();
$house_service
=
new
HouseService
();
$field
=
'id,name,city,longitude'
;
$get_params
[]
=
[
'EXP'
,
"`longitude` = '' or `longitude` is null "
];
$model_res
=
$model
->
getMetroStations
(
$field
,
$get_params
);
$success_num
=
0
;
$fail
=
0
;
foreach
(
$model_res
as
$key
=>
$v
)
{
$id
=
$v
[
'id'
];
$address
=
$v
[
'name'
]
.
'地铁站'
;
$city
=
$v
[
'city'
];
/*获取商圈经纬度*/
$res
=
$house_service
->
getLatLng
(
$address
,
$city
);
if
(
$res
){
$success_num
++
;
$longitude
=
$res
[
'lng'
];
//'经度'
$latitude
=
$res
[
'lat'
];
//'维度'
}
else
{
$fail
++
;
$longitude
=
''
;
//'经度'
$latitude
=
''
;
//'维度'
$log_text
=
'地铁站名:'
.
$v
[
'name'
]
.
' 城市: '
.
$v
[
'city'
]
.
' 数据库ID: '
.
$id
;
big_log
(
$log_text
);
//记录日志
}
$insert
=
[];
$insert
[
"id"
]
=
$id
;
$insert
[
"longitude"
]
=
$longitude
;
// 经度范围-180~180
$insert
[
"latitude"
]
=
$latitude
;
// 纬度范围-90~90
$res
=
$model
->
updateMetroStations
(
$insert
);
//int(1)
$log_text
=
'地铁站名:'
.
$v
[
'name'
]
.
' 城市: '
.
$v
[
'city'
]
.
' 纬度,经度: ['
.
$latitude
.
','
.
$longitude
.
'] 数据库写入返回值: '
.
$res
;
big_log
(
$log_text
);
//记录日志
}
return
$this
->
response
(
"200"
,
"处理完成"
,[
'成功数'
=>
$success_num
,
'失败数'
=>
$fail
]);
}
}
}
application/model/MetroStations.php
View file @
dab364f3
...
@@ -47,4 +47,21 @@ class MetroStations extends BaseModel
...
@@ -47,4 +47,21 @@ class MetroStations extends BaseModel
->
where
(
$where
)
->
where
(
$where
)
->
select
();
->
select
();
}
}
public
function
getMetroStations
(
$field
,
$params
)
{
$result
=
$this
->
field
(
$field
)
->
where
(
$params
)
->
select
();
return
$result
;
}
public
function
updateMetroStations
(
$params
)
{
$result
=
$this
->
update
(
$params
);
//dump($this->getLastSql());
return
$result
;
}
}
}
application/route.php
View file @
dab364f3
...
@@ -413,8 +413,9 @@ Route::group('index', [
...
@@ -413,8 +413,9 @@ Route::group('index', [
'delPerformanceReport'
=>
[
'index/PerformanceReport/delPerformanceReport'
,
[
'method'
=>
'get | post'
]],
//删除
'delPerformanceReport'
=>
[
'index/PerformanceReport/delPerformanceReport'
,
[
'method'
=>
'get | post'
]],
//删除
//批量处理控制器
//批量处理控制器
'getCityLatAadLng'
=>
[
'index/BatchProcessing/getCityLatAadLng'
,
[
'method'
=>
'get | post'
]],
//批量设置商圈的经纬度
'getCityLatAadLng'
=>
[
'index/BatchProcessing/getCityLatAadLng'
,
[
'method'
=>
'get | post'
]
],
//批量设置商圈的经纬度
'updatePhoneFollowUpIsShow'
=>
[
'index/BatchProcessing/updatePhoneFollowUpIsShow'
,
[
'method'
=>
'get | post'
]],
//批量设置商圈的经纬度
'getMetroStationsLatAadLng'
=>
[
'index/BatchProcessing/getMetroStationsLatAadLng'
,
[
'method'
=>
'get | post'
]
],
//
'updatePhoneFollowUpIsShow'
=>
[
'index/BatchProcessing/updatePhoneFollowUpIsShow'
,
[
'method'
=>
'get | post'
]
],
//批量设置商圈的经纬度
//站点相关
//站点相关
...
...
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