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
eb278e9d
Commit
eb278e9d
authored
Jun 13, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取两个经纬度距离
parent
cb6b8320
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
OfficeManage.php
application/index/controller/OfficeManage.php
+35
-0
Basic.php
application/index/extend/Basic.php
+1
-0
route.php
application/route.php
+1
-0
No files found.
application/index/controller/OfficeManage.php
View file @
eb278e9d
...
@@ -11,6 +11,7 @@ namespace app\index\controller;
...
@@ -11,6 +11,7 @@ namespace app\index\controller;
use
app\index\extend\Basic
;
use
app\index\extend\Basic
;
use
app\index\service\OfficeService
;
use
app\index\service\OfficeService
;
use
app\index\service\PositionService
;
use
think\Request
;
use
think\Request
;
class
OfficeManage
extends
Basic
class
OfficeManage
extends
Basic
...
@@ -156,4 +157,37 @@ class OfficeManage extends Basic
...
@@ -156,4 +157,37 @@ class OfficeManage extends Basic
return
$this
->
response
(
$code
,
$msg
,
$data
);
return
$this
->
response
(
$code
,
$msg
,
$data
);
}
}
/**
* 获得两个经纬度距离
*
* @return \think\Response
*/
public
function
getDistance
()
{
$code
=
200
;
$msg
=
""
;
$data
=
[];
$address_latitude
=
$this
->
params
[
'address_latitude'
];
$address_longitude
=
$this
->
params
[
'address_longitude'
];
$stations_latitude
=
$this
->
params
[
'stations_latitude'
];
$stations_longitude
=
$this
->
params
[
'stations_longitude'
];
if
(
empty
(
$address_latitude
)
||
empty
(
$address_longitude
)
||
empty
(
$stations_latitude
)
||
empty
(
$stations_longitude
))
{
return
$this
->
response
(
101
,
'参数错误'
);
}
$first_position
=
$address_latitude
.
','
.
$address_longitude
;
$end_position
=
$stations_latitude
.
','
.
$stations_longitude
;
$position_service
=
new
PositionService
();
$distance
=
$position_service
->
getPositionDistance
(
$first_position
,
$end_position
);
if
(
$distance
)
{
$data
[
'distance'
]
=
$distance
;
}
else
{
$data
[
'distance'
]
=
0
;
$code
=
101
;
$msg
=
'获取距离失败'
;
}
return
$this
->
response
(
$code
,
$msg
,
$data
);
}
}
}
\ No newline at end of file
application/index/extend/Basic.php
View file @
eb278e9d
...
@@ -95,6 +95,7 @@ class Basic extends Controller
...
@@ -95,6 +95,7 @@ class Basic extends Controller
'index/dailyBackImg'
,
'index/dailyBackImg'
,
'office_index/getLabelsList'
,
'office_index/getLabelsList'
,
'index/modifyAgentPassword'
,
'index/modifyAgentPassword'
,
'office_index/getDistance'
,
);
);
/**
/**
...
...
application/route.php
View file @
eb278e9d
...
@@ -1057,6 +1057,7 @@ Route::group('office_index', [
...
@@ -1057,6 +1057,7 @@ Route::group('office_index', [
'inspectionRecordStore/:check_status'
=>
[
'index/OfficeReport/inspectionRecordAll'
,
[
'method'
=>
'GET'
],
[
'check_status'
=>
1
]],
//门店约带看
'inspectionRecordStore/:check_status'
=>
[
'index/OfficeReport/inspectionRecordAll'
,
[
'method'
=>
'GET'
],
[
'check_status'
=>
1
]],
//门店约带看
'inspectionRecordDistrict/:check_status'
=>
[
'index/OfficeReport/inspectionRecordAll'
,
[
'method'
=>
'GET'
],
[
'check_status'
=>
2
]],
//部门约带看
'inspectionRecordDistrict/:check_status'
=>
[
'index/OfficeReport/inspectionRecordAll'
,
[
'method'
=>
'GET'
],
[
'check_status'
=>
2
]],
//部门约带看
'inspectionRecordAll/:check_status'
=>
[
'index/OfficeReport/inspectionRecordAll'
,
[
'method'
=>
'GET'
],
[
'check_status'
=>
3
]],
//全部约带看
'inspectionRecordAll/:check_status'
=>
[
'index/OfficeReport/inspectionRecordAll'
,
[
'method'
=>
'GET'
],
[
'check_status'
=>
3
]],
//全部约带看
'getDistance'
=>
[
'index/OfficeManage/getDistance'
,
[
'method'
=>
'GET'
]],
//获取两个经纬度距离
]);
]);
Route
::
group
(
'office_api'
,
[
Route
::
group
(
'office_api'
,
[
...
...
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