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
dee22cdd
Commit
dee22cdd
authored
Apr 19, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
找铺
parent
d7913f76
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
0 deletions
+134
-0
FindShop.php
application/api/controller/FindShop.php
+129
-0
UFindShop.php
application/model/UFindShop.php
+3
-0
route.php
application/route.php
+2
-0
No files found.
application/api/controller/FindShop.php
View file @
dee22cdd
...
@@ -3,6 +3,10 @@
...
@@ -3,6 +3,10 @@
namespace
app\api\controller
;
namespace
app\api\controller
;
use
app\api\extend\Basic
;
use
app\api\extend\Basic
;
use
app\index\service\HouseService
;
use
app\model\GHouses
;
use
app\model\GHousesImgs
;
use
app\model\GImageDepot
;
use
app\model\UFindShop
;
use
app\model\UFindShop
;
use
think\Request
;
use
think\Request
;
...
@@ -22,6 +26,7 @@ class FindShop extends Basic
...
@@ -22,6 +26,7 @@ class FindShop extends Basic
/**
/**
* 新增取消修改找铺需求
* @return \think\Response
* @return \think\Response
*/
*/
public
function
updateFindShop
()
public
function
updateFindShop
()
...
@@ -79,4 +84,127 @@ class FindShop extends Basic
...
@@ -79,4 +84,127 @@ class FindShop extends Basic
}
}
}
}
/** 获取找铺需求数据
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getFindShopByParams
()
{
$params
=
$this
->
params
;
/* $params = array(
"id"=> 1,
"user_id" => 116
);*/
if
(
empty
(
$params
[
"id"
])
&&
empty
(
$params
[
"user_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$findShopModel
=
new
UFindShop
();
$field
=
"id,user_id,user_name,site_id,city,disc,business_district_id,business_district_name,area_start,area_end,
price_type,price_start,price_end,update_time,create_time"
;
$result
=
$findShopModel
->
getFindShopList
(
$field
,
$params
,
1
,
1
);
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
/**
* 获取推荐商铺列表
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getRecommendShopList
()
{
$params
=
$this
->
params
;
/*$params = array(
"business_id" => 4,
"disc" => "黄浦区", //区域
"city" => "上海市",//城市
"industry_type" => "休闲娱乐",//业态
"business_id" => 111,//商圈id
"shop_area_start" => 45,//面积起始范围
"shop_area_end" => 65,//面积结束范围
"pageNo" => 1,
"pageSize" => 15
);*/
$conditions
=
[];
if
(
empty
(
$params
[
'city'
]))
{
return
$this
->
response
(
"101"
,
"城市不能为空"
);
}
$field
=
"id,external_title as title,external_address as address,city,disc,business_district_id,status,industry_type,
external_image_id,shop_area_start,shop_area_end,shop_type,residue_num,shop_sign,is_carefully_chosen,rent_type,
rent_price,is_show_image,fit_industry_type"
;
$conditions
[
"city"
]
=
trim
(
$params
[
'city'
]);
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$s_house
=
new
HouseService
();
if
(
isset
(
$params
[
'disc'
]))
{
//区域
$conditions
[
'disc'
]
=
array
(
'eq'
,
trim
(
$params
[
'disc'
]));
}
if
(
isset
(
$params
[
'business_id'
]))
{
//商圈
$conditions
[
'business_district_id'
]
=
array
(
'eq'
,
trim
(
$params
[
'business_id'
]));
}
if
(
isset
(
$params
[
'industry_type'
]))
{
//业态
$conditions
[
'industry_type'
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'industry_type'
])
.
"%"
);
}
$area_start
=
isset
(
$params
[
'shop_area_start'
])
?
$params
[
'shop_area_start'
]
:
-
1
;
$area_end
=
isset
(
$params
[
'shop_area_end'
])
?
$params
[
'shop_area_end'
]
:
-
1
;
if
(
$area_start
>=
0
&&
$area_end
>=
0
)
{
//面积
$conditions
[
'shop_area_start'
]
=
array
(
'between'
,
array
(
$area_start
,
$area_end
));
$conditions
[
'shop_area_end'
]
=
array
(
'between'
,
array
(
$area_start
,
$area_end
));
}
else
if
(
$area_start
>=
0
&&
$area_end
<
0
)
{
//100米以上不用传结束面积
$conditions
[
'shop_area_start'
]
=
array
(
'egt'
,
$area_start
);
$conditions
[
'shop_area_end'
]
=
array
(
'egt'
,
$area_start
);
}
$order_
=
"is_exclusive_type desc,id desc"
;
if
(
!
empty
(
$conditions
))
{
$conditions
[
'status'
]
=
array
(
'eq'
,
1
);
//只显示上架
$conditions
[
'is_show'
]
=
array
(
'eq'
,
0
);
//c端只显示可显示的楼盘
}
$gHousesModel
=
new
GHouses
();
$result
=
$gHousesModel
->
getHousesList
(
$pageNo
,
$pageSize
,
$order_
,
$field
,
$conditions
,
[]);
//获取图片信息
$imageDepotModel
=
new
GImageDepot
();
$gHousesImgModel
=
new
GHousesImgs
();
foreach
(
$result
as
$key
=>
$val
)
{
$result
[
$key
][
"api_path"
]
=
SHOP_IMAGE_DEPOT_URL
;
$result
[
$key
][
"rent_price"
]
=
$val
[
"rent_price"
]
*
0.01
;
$result
[
$key
][
"images"
]
=
[];
if
(
empty
(
$val
[
'is_show_image'
]))
{
if
(
$val
[
"external_image_id"
])
{
$param
[
"id"
]
=
array
(
"in"
,
$val
[
"external_image_id"
]);
$param
[
"img_status"
]
=
0
;
$field
=
'id,0 as house_id,img_type,label,img_name,img_status'
;
$res
=
$imageDepotModel
->
getImageDepotById
(
$field
,
$param
,
1
);
$result
[
$key
][
"images"
]
=
count
(
$res
)
>
0
?
$res
:
[];
}
}
else
{
$result
[
$key
][
"api_path"
]
=
CK_IMG_URL
.
'images/'
;
$house_img_where
[
"house_id"
]
=
$val
[
"id"
];
$house_img_where
[
"img_type"
]
=
2
;
$result
[
$key
][
"images"
]
=
$gHousesImgModel
->
getHouseImages
(
$house_img_where
,
1
);
}
#商铺视频
$result
[
$key
][
'shop_videos'
]
=
$s_house
->
getHouseVideoList
(
$val
[
'id'
]);
}
if
(
empty
(
$result
))
{
return
$this
->
response
(
"200"
,
"此条件没有找到数据"
);
}
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
}
}
}
\ No newline at end of file
application/model/UFindShop.php
View file @
dee22cdd
...
@@ -36,6 +36,9 @@ class UFindShop extends Model{
...
@@ -36,6 +36,9 @@ class UFindShop extends Model{
if
(
isset
(
$params
[
'id'
]))
{
if
(
isset
(
$params
[
'id'
]))
{
$where_
[
"id"
]
=
$params
[
'id'
];
$where_
[
"id"
]
=
$params
[
'id'
];
}
}
if
(
isset
(
$params
[
'user_id'
]))
{
$where_
[
"user_id"
]
=
$params
[
'user_id'
];
}
$where_
[
"is_del"
]
=
0
;
$where_
[
"is_del"
]
=
0
;
return
$this
->
db_
return
$this
->
db_
->
field
(
$field
)
->
field
(
$field
)
...
...
application/route.php
View file @
dee22cdd
...
@@ -550,6 +550,8 @@ Route::group('api', [
...
@@ -550,6 +550,8 @@ Route::group('api', [
'updateFindShop'
=>
[
'api/FindShop/updateFindShop'
,
[
'method'
=>
'get|post'
]],
'updateFindShop'
=>
[
'api/FindShop/updateFindShop'
,
[
'method'
=>
'get|post'
]],
'getFindShop'
=>
[
'api/FindShop/getFindShopByParams'
,
[
'method'
=>
'get|post'
]],
'getRecommendShopList'
=>
[
'api/FindShop/getRecommendShopList'
,
[
'method'
=>
'get|post'
]],
]);
]);
...
...
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