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
15022c83
Commit
15022c83
authored
Dec 08, 2017
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
楼盘详情
parent
b8ac5310
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
4 deletions
+45
-4
Shop.php
application/api/controller/Shop.php
+34
-3
HouseInfos.php
application/model/HouseInfos.php
+9
-1
route.php
application/route.php
+2
-0
No files found.
application/api/controller/Shop.php
View file @
15022c83
...
@@ -14,6 +14,13 @@ use app\model\HouseInfos;
...
@@ -14,6 +14,13 @@ use app\model\HouseInfos;
class
Shop
extends
Basic
class
Shop
extends
Basic
{
{
protected
$db
;
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
db
=
new
HouseInfos
();
}
/**
/**
* @return \think\Response
* @return \think\Response
...
@@ -100,12 +107,35 @@ class Shop extends Basic
...
@@ -100,12 +107,35 @@ class Shop extends Basic
$conditions
[
'room_num_left'
]
=
array
(
'<>'
,
0
);
$conditions
[
'room_num_left'
]
=
array
(
'<>'
,
0
);
}
}
$HouseInfos
=
new
HouseInfos
();
$result
=
$this
->
db
->
getHouseInfoList
(
$pageNo
,
$pageSize
,
$order_
,
$field
,
$conditions
);
$result
=
$HouseInfos
->
getHouseInfoList
(
$pageNo
,
$pageSize
,
$order_
,
$field
,
$conditions
);
if
(
empty
(
$result
))
{
if
(
empty
(
$result
))
{
return
$this
->
response
(
"200"
,
"此条件没有找到数据"
);
return
$this
->
response
(
"200"
,
"此条件没有找到数据"
);
}
}
return
$this
->
response
(
"200"
,
''
,
$result
);
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
}
/**
* 楼盘详情
* @return \think\Response
*/
public
function
getShopDetail
()
{
$params
=
$this
->
params
;
$field
=
"id,management_fee,title,address,city,disc,disccircles,sales,yetai,room_area2,shangpu_type,is_test,
room_num_left,shangpu_tags,carefully_chosen,price,dish,file_path"
;
$conditions
=
[];
if
(
empty
(
$params
[
'id'
]))
{
return
$this
->
response
(
"101"
,
"详情id不能为空"
);
}
$conditions
[
'id'
]
=
array
(
"eq"
,
$params
[
"id"
]
);
$result
=
$this
->
db
->
getHouseDetail
(
$field
,
$conditions
);
if
(
$result
[
'room_num_left'
]
==
0
){
return
$this
->
response
(
"101"
,
'此楼盘已下架'
);
}
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
}
}
}
}
\ No newline at end of file
application/model/HouseInfos.php
View file @
15022c83
...
@@ -42,7 +42,8 @@ class HouseInfos extends Model
...
@@ -42,7 +42,8 @@ class HouseInfos extends Model
* @return float
* @return float
*/
*/
function
getAveragePrice
()
function
getAveragePrice
()
{
//price
{
//price
$params
[
'rent_type'
]
=
array
(
"eq"
,
1
);
//月租金类型
$params
[
'rent_type'
]
=
array
(
"eq"
,
1
);
//月租金类型
$params
[
'room_num_left'
]
=
array
(
"<>"
,
0
);
//剩余店铺为0的不算
$params
[
'room_num_left'
]
=
array
(
"<>"
,
0
);
//剩余店铺为0的不算
...
@@ -58,6 +59,13 @@ class HouseInfos extends Model
...
@@ -58,6 +59,13 @@ class HouseInfos extends Model
return
$averagePrice
;
return
$averagePrice
;
}
}
function
getHouseDetail
(
$field
,
$params
)
{
return
$data
=
$this
->
dbHouseInfo
->
field
(
$field
)
->
where
(
$params
)
->
select
();
}
}
}
application/route.php
View file @
15022c83
...
@@ -56,6 +56,7 @@ Route::group('api',[
...
@@ -56,6 +56,7 @@ Route::group('api',[
//post shop
//post shop
'shopList'
=>
[
'api/shop/getShopList'
,
[
'method'
=>
'post'
]],
'shopList'
=>
[
'api/shop/getShopList'
,
[
'method'
=>
'post'
]],
'shopDetail'
=>
[
'api/shop/getShopDetail'
,
[
'method'
=>
'get'
]],
]);
]);
\ 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