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
9329339b
Commit
9329339b
authored
Jun 13, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
eb278e9d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
BatchProcessing.php
application/index/controller/BatchProcessing.php
+2
-5
HouseService.php
application/index/service/HouseService.php
+7
-5
No files found.
application/index/controller/BatchProcessing.php
View file @
9329339b
...
...
@@ -123,7 +123,7 @@ class BatchProcessing extends Basic
$model
=
new
OfficeGBuilding
();
$house_service
=
new
HouseService
();
$field
=
'id,title,address,city,longitude'
;
$field
=
'id,title,address,city,
disc,
longitude'
;
$get_params
[]
=
[
'EXP'
,
"`longitude` = '' or `longitude` is null "
];
$model_res
=
$model
->
getBusinessDistrict
(
$field
,
$get_params
);
...
...
@@ -131,14 +131,11 @@ class BatchProcessing extends Basic
$fail
=
0
;
foreach
(
$model_res
as
$key
=>
$v
)
{
$id
=
$v
[
'id'
];
// $address = $v['city'].$v['disc'].$v['address'];
$address
=
$v
[
'address'
];
$city
=
$v
[
'city'
];
/*获取商圈经纬度*/
$res
=
$house_service
->
getLatLng
(
$address
,
$city
);
dump
(
$address
);
dump
(
$city
);
dump
(
$res
);
exit
;
if
(
$res
){
$success_num
++
;
...
...
application/index/service/HouseService.php
View file @
9329339b
...
...
@@ -12,6 +12,7 @@ namespace app\index\service;
use
app\api_broker\service\PushMessageService
;
use
app\api_broker\service\RedisCacheService
;
use
app\api_broker\service\VipService
;
use
app\chat\utils\CurlUtil
;
use
app\extra\RedisExt
;
use
app\index\validate\HouseValidate
;
use
app\model\AAgents
;
...
...
@@ -591,14 +592,15 @@ class HouseService
*/
function
getLatLng
(
$address
=
''
,
$city
=
''
)
{
$result
=
array
();
$ak
=
'eqkGg4WQehHn4k7ssWZTv8RPvydUm35s'
;
//百度地图ak,百度开发者中心去免费申请
$url
=
"http://api.map.baidu.com/geocoder/v2/?callback=renderOption&output=json&address="
.
$address
.
"&city="
.
$city
.
"&ak="
.
$ak
;
$data
=
file_get_contents
(
$url
);
$data
=
str_replace
(
'renderOption&&renderOption('
,
''
,
$data
);
$result
=
array
();
$curl
=
new
CurlUtil
();
$url
=
"http://api.map.baidu.com/geocoder/v2/?address=
{
$address
}
&output=json&ak=
{
$ak
}
&callback=json&city=
{
$city
}
"
;
$data
=
$curl
->
get
(
$url
);
$data
=
str_replace
(
'json&&json('
,
''
,
$data
->
body
);
$data
=
str_replace
(
')'
,
''
,
$data
);
$data
=
json_decode
(
$data
,
true
);
// exit;
if
(
!
empty
(
$data
)
&&
$data
[
'status'
]
==
0
)
{
$result
[
'lat'
]
=
$data
[
'result'
][
'location'
][
'lat'
];
$result
[
'lng'
]
=
$data
[
'result'
][
'location'
][
'lng'
];
...
...
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