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
b1b1fa7c
Commit
b1b1fa7c
authored
Jan 05, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化搜素
parent
84fdc257
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
Shop.php
application/api/controller/Shop.php
+7
-6
HouseInfos.php
application/model/HouseInfos.php
+6
-3
No files found.
application/api/controller/Shop.php
View file @
b1b1fa7c
...
@@ -37,18 +37,18 @@ class Shop extends Basic
...
@@ -37,18 +37,18 @@ class Shop extends Basic
public
function
getShopList
()
public
function
getShopList
()
{
{
/*
$params = array(
/*
$params = array(
"site_area" => 2, //来源 1首页 2搜索
"site_area" => 2, //来源 1首页 2搜索
"title" => "尚美",
"title" => "尚美",
"carefully_chosen" => 0, //精选商铺--0是1否
"carefully_chosen" => 0, //精选商铺--0是1否
"shangpu_type"
=> 0, //商铺类型(0商场,1街铺)
"shangpu_type"
=> 0, //商铺类型(0商场,1街铺)
"disc" => "黄浦区",
"disc" => "黄浦区",
"yetai" => "休闲娱乐",
"yetai" => "休闲娱乐",
"area_start" => 45,//面积起始范围 room_area2
"area_start" => 45,//面积起始范围 room_area2
"area_end" => 65,//面积结束范围
"area_end" => 65,//面积结束范围
"money_start" => 1000,//租金 price2
"money_start" => 1000,//租金 price2
"money_end" => 10000,//租金
"money_end" => 10000,//租金
"shangpu_tags" => "临近地铁,
",
"shangpu_tags" => "临近地铁,临近地铁2
",
"pageNo" => "1",
"pageNo" => "1",
"pageSize" => 15
"pageSize" => 15
);*/
);*/
...
@@ -68,6 +68,7 @@ class Shop extends Basic
...
@@ -68,6 +68,7 @@ class Shop extends Basic
$conditions
[
'title'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'title'
])
.
"%"
);
$conditions
[
'title'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'title'
])
.
"%"
);
}
}
$order_
=
""
;
$order_
=
""
;
$spTagArr
=
array
();
switch
(
$params
[
'site_area'
])
{
switch
(
$params
[
'site_area'
])
{
case
1
:
case
1
:
if
(
isset
(
$params
[
'carefully_chosen'
])
&&
$params
[
'carefully_chosen'
]
==
0
)
{
if
(
isset
(
$params
[
'carefully_chosen'
])
&&
$params
[
'carefully_chosen'
]
==
0
)
{
...
@@ -105,10 +106,10 @@ class Shop extends Basic
...
@@ -105,10 +106,10 @@ class Shop extends Basic
if
(
isset
(
$params
[
'shangpu_tags'
])
&&
$params
[
'shangpu_tags'
]
!=
"全部"
)
{
//商铺标签
if
(
isset
(
$params
[
'shangpu_tags'
])
&&
$params
[
'shangpu_tags'
]
!=
"全部"
)
{
//商铺标签
$shangpuTagsArr
=
array_filter
(
explode
(
','
,
$params
[
'shangpu_tags'
]));
$shangpuTagsArr
=
array_filter
(
explode
(
','
,
$params
[
'shangpu_tags'
]));
if
(
count
(
$shangpuTagsArr
)
==
1
)
{
if
(
count
(
$shangpuTagsArr
)
==
1
)
{
$
conditions
[
'shangpu_tags'
]
=
array
(
'like'
,
"%"
.
trim
(
$shangpuTagsArr
[
0
])
.
"%"
);
$
spTagArr
[
'shangpu_tags'
]
=
array
(
'like'
,
"%"
.
trim
(
$shangpuTagsArr
[
0
])
.
"%"
);
}
else
{
}
else
{
foreach
(
$shangpuTagsArr
as
$key
=>
$val
)
{
foreach
(
$shangpuTagsArr
as
$key
=>
$val
)
{
$
conditions
[
'shangpu_tags'
][]
=
array
(
'like'
,
"%"
.
trim
(
$val
)
.
"%"
);
$
spTagArr
[
'shangpu_tags'
][]
=
array
(
'like'
,
"%"
.
trim
(
$val
)
.
"%"
);
}
}
}
}
}
}
...
@@ -125,7 +126,7 @@ class Shop extends Basic
...
@@ -125,7 +126,7 @@ class Shop extends Basic
$conditions
[
'show_all'
]
=
array
(
'eq'
,
0
);
//只显示公开的楼盘
$conditions
[
'show_all'
]
=
array
(
'eq'
,
0
);
//只显示公开的楼盘
}
}
$result
=
$this
->
db
->
getHouseInfoList
(
$pageNo
,
$pageSize
,
$order_
,
$field
,
$conditions
);
$result
=
$this
->
db
->
getHouseInfoList
(
$pageNo
,
$pageSize
,
$order_
,
$field
,
$conditions
,
$spTagArr
);
//获取图片信息
//获取图片信息
foreach
(
$result
as
$key
=>
$val
)
{
foreach
(
$result
as
$key
=>
$val
)
{
...
...
application/model/HouseInfos.php
View file @
b1b1fa7c
...
@@ -25,11 +25,14 @@ class HouseInfos extends Model
...
@@ -25,11 +25,14 @@ class HouseInfos extends Model
* @param $params
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @return false|\PDOStatement|string|\think\Collection
*/
*/
function
getHouseInfoList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
,
$params
)
function
getHouseInfoList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
,
$params
,
$spTagsArr
)
{
{
return
$
data
=
$
this
->
dbHouseInfo
return
$this
->
dbHouseInfo
->
field
(
$field
)
->
field
(
$field
)
->
where
(
$params
)
->
where
(
$params
)
->
where
(
function
(
$query
)
use
(
$spTagsArr
)
{
$query
->
whereOr
(
$spTagsArr
);
})
->
order
(
$order_
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
page
(
$pageNo
)
...
@@ -73,7 +76,7 @@ class HouseInfos extends Model
...
@@ -73,7 +76,7 @@ class HouseInfos extends Model
}
}
function
getCityList
(
$field
,
$params
,
$group
)
function
getCityList
(
$field
,
$params
,
$group
)
{
{
return
$data
=
$this
->
dbHouseInfo
return
$data
=
$this
->
dbHouseInfo
->
field
(
$field
)
->
field
(
$field
)
...
...
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