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
273b73c5
Commit
273b73c5
authored
Oct 26, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
百度接口-根据城市商圈获取经纬度 优化
parent
3fff4fd2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
25 deletions
+2
-25
BatchProcessing.php
application/index/controller/BatchProcessing.php
+0
-24
HouseService.php
application/index/service/HouseService.php
+2
-1
No files found.
application/index/controller/BatchProcessing.php
View file @
273b73c5
...
@@ -68,29 +68,5 @@ class BatchProcessing extends Basic
...
@@ -68,29 +68,5 @@ class BatchProcessing extends Basic
}
}
/**
* @param string $address 地址
* @param string $city 城市名
* @return array
*/
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
);
$data
=
str_replace
(
')'
,
''
,
$data
);
$data
=
json_decode
(
$data
,
true
);
if
(
!
empty
(
$data
)
&&
$data
[
'status'
]
==
0
)
{
$result
[
'lat'
]
=
$data
[
'result'
][
'location'
][
'lat'
];
$result
[
'lng'
]
=
$data
[
'result'
][
'location'
][
'lng'
];
return
$result
;
//返回经纬度结果
}
else
{
return
null
;
}
}
}
}
application/index/service/HouseService.php
View file @
273b73c5
...
@@ -393,6 +393,7 @@ class HouseService
...
@@ -393,6 +393,7 @@ class HouseService
/**
/**
* 百度接口-根据城市商圈获取经纬度
* @param string $address 地址
* @param string $address 地址
* @param string $city 城市名
* @param string $city 城市名
* @return array
* @return array
...
@@ -400,7 +401,7 @@ class HouseService
...
@@ -400,7 +401,7 @@ class HouseService
function
getLatLng
(
$address
=
''
,
$city
=
''
)
function
getLatLng
(
$address
=
''
,
$city
=
''
)
{
{
$result
=
array
();
$result
=
array
();
$ak
=
'eqkGg4WQehHn4k7ssWZTv8RPvydUm35s'
;
//
您的百度地图ak,可以去
百度开发者中心去免费申请
$ak
=
'eqkGg4WQehHn4k7ssWZTv8RPvydUm35s'
;
//
百度地图ak,
百度开发者中心去免费申请
$url
=
"http://api.map.baidu.com/geocoder/v2/?callback=renderOption&output=json&address="
.
$address
.
"&city="
.
$city
.
"&ak="
.
$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
=
file_get_contents
(
$url
);
$data
=
str_replace
(
'renderOption&&renderOption('
,
''
,
$data
);
$data
=
str_replace
(
'renderOption&&renderOption('
,
''
,
$data
);
...
...
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