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
6c4c92ca
Commit
6c4c92ca
authored
Sep 19, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询定位图
parent
940f953f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
2 deletions
+66
-2
Location.php
application/api_broker/controller/Location.php
+49
-1
ALocationListModel.php
application/model/ALocationListModel.php
+16
-1
route.php
application/route.php
+1
-0
No files found.
application/api_broker/controller/Location.php
View file @
6c4c92ca
...
...
@@ -7,6 +7,7 @@ use app\api_broker\service\LocationService;
use
app\api_broker\service\RedisCacheService
;
use
app\extra\RedisExt
;
use
app\index\service\PositionService
;
use
app\model\AAgents
;
use
app\model\ALocationListModel
;
use
think\Request
;
...
...
@@ -62,7 +63,7 @@ class Location extends Basic
*/
public
function
addLocation
()
{
$code
=
101
;
$code
=
101
;
$params
=
&
$this
->
params
;
if
(
!
isset
(
$params
[
'longitude'
])
||
!
isset
(
$params
[
'latitude'
])
||
!
isset
(
$params
[
'source'
])
...
...
@@ -83,4 +84,50 @@ class Location extends Basic
$msg
=
$result
[
'msg'
];
return
$this
->
response
(
$code
,
$msg
);
}
/**
* 查询定位图
*
* @return \think\Response
*/
public
function
getLocationList
()
{
$params
=
&
$this
->
params
;
if
(
empty
(
$params
[
'location_date'
]))
{
return
$this
->
response
(
101
,
'日期时间错误'
);
}
else
{
$where
[
'location_date'
]
=
date
(
'Y-m-d'
,
strtotime
(
$params
[
'location_date'
]));
}
$s_redis
=
new
RedisCacheService
();
switch
(
$params
[
'type'
])
{
case
1
:
if
(
empty
(
$params
[
'agent_name'
]))
{
return
$this
->
response
(
101
,
'查询人参数错误'
);
}
$m_agent
=
new
AAgents
();
$agent_where
[
'name'
]
=
[
'like'
,
'%'
.
$params
[
'agent_name'
]
.
'%'
];
$agent_id
=
$m_agent
->
getFieldOneValue
(
'id'
,
$where
);
if
(
empty
(
$agent_id
))
{
return
$this
->
response
(
101
,
'没有该经纪人'
);
}
$where
[
'agent_id'
]
=
$agent_id
;
$agent_data
=
$s_redis
->
getRedisCache
(
2
,
$this
->
agentId
);
$is_
=
$s_redis
->
checkRule
(
$this
->
agentId
,
'location_district'
);
//全公司的
if
(
$is_
)
{
$where
[
'district_id'
]
=
$agent_data
[
'district_id'
];
//本部门
$is_
=
$s_redis
->
checkRule
(
$this
->
agentId
,
'location_store'
);
//全门店
if
(
$is_
)
{
$where
[
'store_id'
]
=
$agent_data
[
'store_id'
];
//本门店
}
}
break
;
default
:
$where
[
'agent_id'
]
=
$this
->
agentId
;
//默认查询自己
}
$m_location
=
new
ALocationListModel
();
$field
=
'longitude,latitude'
;
$data
=
$m_location
->
findAllData
(
$field
,
$where
);
return
$this
->
response
(
200
,
''
,
$data
);
}
}
\ No newline at end of file
application/model/ALocationListModel.php
View file @
6c4c92ca
...
...
@@ -12,7 +12,7 @@ use think\Model;
* Time : 14:26:58
* Intro:
*/
class
ALocationListModel
extends
Model
class
ALocationListModel
extends
Base
Model
{
protected
$table
=
"a_location_list"
;
private
$db_
;
...
...
@@ -45,4 +45,18 @@ class ALocationListModel extends Model
->
order
(
$order
)
->
find
();
}
/**
* @param $field
* @param $where
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
findAllData
(
$field
,
$where
,
$order
=
'id asc'
)
{
return
$this
->
db_
->
field
(
$field
)
->
where
(
$where
)
->
order
(
$order
)
->
select
();
}
}
\ No newline at end of file
application/route.php
View file @
6c4c92ca
...
...
@@ -1008,6 +1008,7 @@ Route::group('broker', [
'saveSiteCity'
=>
[
'api_broker/Location/saveSiteCity'
,
[
'method'
=>
'POST|GET'
]],
//保存默认城市选择
'addLocation'
=>
[
'api_broker/Location/addLocation'
,
[
'method'
=>
'POST|get'
]],
//新增定位
'getLocationList'
=>
[
'api_broker/Location/getLocationList'
,
[
'method'
=>
'POST|get'
]],
//定位多个坐标
'bargainMain'
=>
[
'api_broker/Bargain/bargainList'
,
[
'method'
=>
'POST|GET'
]],
'bargainMainV2'
=>
[
'api_broker/Bargain/bargainListV2'
,
[
'method'
=>
'POST|GET'
]],
'bargainListSearchBargainId'
=>
[
'api_broker/Bargain/bargainListSearchBargainId'
,
[
'method'
=>
'POST|GET'
]],
...
...
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