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
a1003dd0
Commit
a1003dd0
authored
Jun 13, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
5f2a4562
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
0 deletions
+58
-0
BatchProcessing.php
application/index/controller/BatchProcessing.php
+49
-0
OfficeGBuilding.php
application/model/OfficeGBuilding.php
+9
-0
No files found.
application/index/controller/BatchProcessing.php
View file @
a1003dd0
...
...
@@ -6,6 +6,7 @@ use app\index\extend\Basic;
use
app\index\service\HouseService
;
use
app\model\GBusinessDistrict
;
use
app\model\MetroStations
;
use
app\model\OfficeGBuilding
;
use
think\Log
;
/**
...
...
@@ -113,5 +114,53 @@ class BatchProcessing extends Basic
return
$this
->
response
(
"200"
,
"处理完成"
,[
'成功数'
=>
$success_num
,
'失败数'
=>
$fail
]);
}
/**
* 楼盘经纬度
* @return \think\Response
*/
public
function
getBuildingLatAadLng
(){
$model
=
new
OfficeGBuilding
();
$house_service
=
new
HouseService
();
$field
=
'id,title,address,city,longitude'
;
$get_params
[]
=
[
'EXP'
,
"`longitude` = '' or `longitude` is null "
];
$model_res
=
$model
->
getBusinessDistrict
(
$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
);
dump
(
$res
);
exit
;
if
(
$res
){
$success_num
++
;
$longitude
=
$res
[
'lng'
];
//'经度'
$latitude
=
$res
[
'lat'
];
//'维度'
}
else
{
$fail
++
;
$longitude
=
''
;
//'经度'
$latitude
=
''
;
//'维度'
$log_text
=
'商圈:'
.
$v
[
'name'
]
.
' 城市: '
.
$v
[
'city'
]
.
' 数据库ID: '
.
$id
;
Log
::
write
(
$log_text
,
'获取商圈经纬度-失败'
);
//记录日志
}
$insert
=
[];
$insert
[
"id"
]
=
$id
;
$insert
[
"longitude"
]
=
$longitude
;
$insert
[
"latitude"
]
=
$latitude
;
$res
=
$model
->
updateBusinessDistrict
(
$insert
);
//int(1)
$log_text
=
'商圈:'
.
$v
[
'name'
]
.
' 城市: '
.
$v
[
'city'
]
.
' 经度: '
.
$longitude
.
' 纬度: '
.
$latitude
.
' 数据库写入返回值: '
.
$res
;
Log
::
write
(
$log_text
,
'获取商圈经纬度'
);
//记录日志
}
return
$this
->
response
(
"200"
,
"处理完成"
,[
'成功数'
=>
$success_num
,
'失败数'
=>
$fail
]);
}
}
application/model/OfficeGBuilding.php
View file @
a1003dd0
...
...
@@ -160,4 +160,13 @@ class OfficeGBuilding extends BaseModel
->
group
(
'a.id'
)
->
select
();
}
public
function
getBusinessDistrict
(
$field
,
$params
)
{
$result
=
$this
->
field
(
$field
)
->
where
(
$params
)
->
select
();
return
$result
;
}
}
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