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
67fd3aba
Commit
67fd3aba
authored
Oct 17, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
地图找房
parent
bdc525c9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
16 deletions
+39
-16
MapFindHouse.php
application/api_broker/controller/MapFindHouse.php
+32
-15
MapFindHouseValidate.php
application/api_broker/validate/MapFindHouseValidate.php
+7
-1
No files found.
application/api_broker/controller/MapFindHouse.php
View file @
67fd3aba
...
@@ -16,6 +16,7 @@ use think\Request;
...
@@ -16,6 +16,7 @@ use think\Request;
class
MapFindHouse
extends
Basic
class
MapFindHouse
extends
Basic
{
{
private
$gHousesModel
;
private
$gHousesModel
;
public
function
__construct
(
Request
$request
=
null
)
public
function
__construct
(
Request
$request
=
null
)
{
{
parent
::
__construct
(
$request
);
parent
::
__construct
(
$request
);
...
@@ -34,7 +35,7 @@ class MapFindHouse extends Basic
...
@@ -34,7 +35,7 @@ class MapFindHouse extends Basic
/* $params = array(
/* $params = array(
"first_spot" => "1223,1213123",
"first_spot" => "1223,1213123",
"second_spot" => "1223,1213123",
"second_spot" => "1223,1213123",
"grade" => 1,//1 市,2区
,3街道
"grade" => 1,//1 区,2商圈
,3街道
"source" => 1,//来源 1b端,2c端
"source" => 1,//来源 1b端,2c端
);*/
);*/
$checkResult
=
$this
->
validate
(
$params
,
"MapFindHouseValidate.getShopListByMap"
);
$checkResult
=
$this
->
validate
(
$params
,
"MapFindHouseValidate.getShopListByMap"
);
...
@@ -44,25 +45,40 @@ class MapFindHouse extends Basic
...
@@ -44,25 +45,40 @@ class MapFindHouse extends Basic
$first_spot_arr
=
explode
(
$params
[
"first_spot"
],
","
);
$first_spot_arr
=
explode
(
$params
[
"first_spot"
],
","
);
$second_spot_arr
=
explode
(
$params
[
"second_spot"
],
","
);
$second_spot_arr
=
explode
(
$params
[
"second_spot"
],
","
);
if
(
count
(
$first_spot_arr
)
<
2
||
count
(
$second_spot_arr
)
<
2
)
{
if
(
count
(
$first_spot_arr
)
<
2
||
count
(
$second_spot_arr
)
<
2
)
{
return
$this
->
response
(
"101"
,
"坐标传入有误"
);
return
$this
->
response
(
"101"
,
"坐标传入有误
1
"
);
}
}
$conditions
=
[];
$conditions
=
[];
$conditions
[
"longitude"
]
=
array
(
"between"
,
array
(
$first_spot_arr
[
0
],
$second_spot_arr
[
0
]));
$conditions
[
"longitude"
]
=
array
(
"between"
,
array
(
$first_spot_arr
[
0
],
$second_spot_arr
[
0
]));
$conditions
[
"latitude"
]
=
array
(
"between"
,
array
(
$first_spot_arr
[
1
],
$second_spot_arr
[
1
]));
$conditions
[
"latitude"
]
=
array
(
"between"
,
array
(
$first_spot_arr
[
1
],
$second_spot_arr
[
1
]));
/*switch ($params["grade"]){
case 1:
break;
case 2:
break;
case 3:
break;
default:
}*/
$field
=
"id,internal_title,longitude,latitude"
;
$field
=
"id,internal_title,longitude,latitude"
;
$result
=
$this
->
gHousesModel
->
getHousesListByMap
(
$field
,
$conditions
);
$result
=
$this
->
gHousesModel
->
getHousesListByMap
(
$field
,
$conditions
);
return
$this
->
response
(
"200"
,
"success"
,
$result
);
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
public
function
getCityInfoByMap
(){
$params
=
$this
->
params
;
/* $params = array(
"spot" => "1223,1213123",
"grade" => 1,//1 区,2商圈,3街道
"source" => 1,//来源 1b端,2c端
"city" => "上海市"//传城市就好了
);*/
$checkResult
=
$this
->
validate
(
$params
,
"MapFindHouseValidate.getCityInfoByMap"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$conditions
=
[];
if
(
$params
[
"grade"
]
==
1
){
}
elseif
(
$params
[
"grade"
]
==
2
){
}
}
$field
=
"id,internal_title,longitude,latitude"
;
$result
=
$this
->
gHousesModel
->
getHousesListByMap
(
$field
,
$conditions
);
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
}
}
\ No newline at end of file
application/api_broker/validate/MapFindHouseValidate.php
View file @
67fd3aba
...
@@ -18,11 +18,15 @@ class MapFindHouseValidate extends Validate
...
@@ -18,11 +18,15 @@ class MapFindHouseValidate extends Validate
'second_spot'
=>
'require'
,
'second_spot'
=>
'require'
,
'grade'
=>
'require|number|in:1,2,3'
,
'grade'
=>
'require|number|in:1,2,3'
,
'source'
=>
'require|number|in:1,2'
,
'source'
=>
'require|number|in:1,2'
,
'spot'
=>
'require'
,
'city'
=>
'require'
,
];
];
protected
$message
=
[
protected
$message
=
[
'first_spot.require'
=>
'坐标为必传字段'
,
'first_spot.require'
=>
'坐标为必传字段'
,
'second_spot.require'
=>
'坐标为必传字段'
,
'second_spot.require'
=>
'坐标为必传字段'
,
'spot.require'
=>
'坐标为必传字段'
,
'city.require'
=>
'城市为必传字段'
,
'grade.require'
=>
'级别为必传'
,
'grade.require'
=>
'级别为必传'
,
'grade.number'
=>
'级别为必传'
,
'grade.number'
=>
'级别为必传'
,
'grade.in'
=>
'级别参数错误'
,
'grade.in'
=>
'级别参数错误'
,
...
@@ -32,6 +36,7 @@ class MapFindHouseValidate extends Validate
...
@@ -32,6 +36,7 @@ class MapFindHouseValidate extends Validate
];
];
protected
$scene
=
[
protected
$scene
=
[
'getShopListByMap'
=>
[
'first_spot'
,
'second_spot'
,
'grade'
,
'source'
],
'getShopListByMap'
=>
[
'first_spot'
,
'second_spot'
,
'grade'
,
'source'
],
'getCityInfoByMap'
=>
[
'spot'
,
'city'
,
'grade'
,
'source'
],
];
];
}
}
\ No newline at end of file
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