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
ce34f5fe
Commit
ce34f5fe
authored
Feb 26, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商铺list
parent
5f8c1215
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
183 additions
and
1 deletion
+183
-1
Shop.php
application/api_broker/controller/Shop.php
+157
-0
GHouses.php
application/model/GHouses.php
+0
-0
GHousesImgs.php
application/model/GHousesImgs.php
+22
-1
route.php
application/route.php
+4
-0
No files found.
application/api_broker/controller/Shop.php
0 → 100644
View file @
ce34f5fe
<?php
namespace
app\api_broker\controller
;
use
app\api_broker\extend\Basic
;
use
app\model\GHouses
;
use
app\model\GHousesImgs
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/2/26
* Time : 10:36
* Intro:
*/
class
Shop
extends
Basic
{
private
$gHousesModel
;
private
$gHousesImgModel
;
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
gHousesModel
=
new
GHouses
();
$this
->
gHousesImgModel
=
new
GHousesImgs
();
}
/**查询商品列表 b c端公用
* @return \think\Response
*/
public
function
getShopList
()
{
$params
=
array
(
"site_area"
=>
1
,
//来源 1c首页 2c搜索 3b首页 4b搜索
"title"
=>
"vv"
,
//1,2 external_title ,3,4internal_title
/*"is_carefully_chosen" => 0, //精选商铺--0否1是
"shop_type" => 0, //商铺类型(0商场,1街铺)
"disc" => "黄浦区",
"industry_type" => "休闲娱乐",
"shop_area_start" => 45,//面积起始范围 街铺start和end面积一样
"shop_area_end" => 65,//面积结束范围
"rent_price_start" => 1000,//租金 rent_price
"rent_price_end" => 10000,//租金
"shop_sign" => "临近地铁,临近地铁2",
"pageNo" => 1,
"pageSize" => 15*/
);
//$params = $this->params;
$conditions
=
[];
if
(
empty
(
$params
[
'site_area'
]))
{
return
$this
->
response
(
"101"
,
"请求来源不能为空"
);
}
if
(
$params
[
'site_area'
]
==
1
||
$params
[
'site_area'
]
==
2
)
{
$field
=
"id,external_title as title,external_address as address,city,disc,business_district_id,status,industry_type
,shop_area_start,shop_area_end,shop_type,residue_num,shop_sign,is_carefully_chosen,rent_type,rent_price"
;
}
else
{
$field
=
"id,internal_title as title,internal_address as address,city,disc,business_district_id,status,industry_type
,shop_area_start,shop_area_end,shop_type,residue_num,shop_sign,is_carefully_chosen,rent_type,rent_price"
;
}
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
//c端查对外的名字 b端查对内的名字
if
(
isset
(
$params
[
'title'
])
&&
$params
[
'site_area'
]
==
1
||
$params
[
'site_area'
]
==
2
)
{
$conditions
[
'external_title'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'title'
])
.
"%"
);
}
else
if
(
isset
(
$params
[
'title'
]))
{
$conditions
[
'internal_title'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'title'
])
.
"%"
);
}
$order_
=
""
;
$spTagArr
=
array
();
switch
(
$params
[
'site_area'
])
{
case
1
:
case
3
:
if
(
isset
(
$params
[
'is_carefully_chosen'
])
&&
$params
[
'is_carefully_chosen'
]
==
1
)
{
$conditions
[
'is_carefully_chosen'
]
=
array
(
'eq'
,
$params
[
'is_carefully_chosen'
]
);
$order_
=
"home_page_sort desc, id desc"
;
}
break
;
case
2
:
case
4
:
if
(
isset
(
$params
[
'disc'
]))
{
//区域
$conditions
[
'disc'
]
=
array
(
'eq'
,
trim
(
$params
[
'disc'
])
);
}
if
(
isset
(
$params
[
'industry_type'
]))
{
//业态
$conditions
[
'industry_type'
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'industry_type'
])
.
"%"
);
}
if
(
isset
(
$params
[
'shop_type'
]))
{
//商铺类型
$conditions
[
'shop_type'
]
=
array
(
"eq"
,
$params
[
'shop_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
*
10000
,
$area_end
*
10000
)
);
$conditions
[
'shop_area_end'
]
=
array
(
'between'
,
array
(
$area_start
*
10000
,
$area_end
*
10000
)
);
}
else
if
(
$area_start
>=
0
&&
$area_end
<
0
)
{
//100米以上不用传结束面积
$conditions
[
'shop_area_start'
]
=
array
(
'egt'
,
$area_start
*
10000
);
$conditions
[
'shop_area_end'
]
=
array
(
'egt'
,
$area_start
*
10000
);
}
$price_start
=
isset
(
$params
[
'rent_price_start'
])
?
$params
[
'rent_price_start'
]
:
-
1
;
$price_end
=
isset
(
$params
[
'rent_price_end'
])
?
$params
[
'rent_price_end'
]
:
-
1
;
if
(
$price_start
>=
0
&&
$price_end
>=
0
)
{
//金额
$conditions
[
'rent_price'
]
=
array
(
'between'
,
array
(
$price_start
*
100
,
$price_end
*
100
)
);
}
else
if
(
$price_start
>=
0
&&
$price_end
<
0
)
{
$conditions
[
'rent_price'
]
=
array
(
'egt'
,
$price_start
*
100
);
}
if
(
isset
(
$params
[
'shop_sign'
])
&&
$params
[
'shop_sign'
]
!=
"全部"
)
{
//商铺标签
$shopTagsArr
=
array_filter
(
explode
(
','
,
$params
[
'shop_sign'
]));
if
(
count
(
$shopTagsArr
)
==
1
)
{
$spTagArr
[
'shop_sign'
]
=
array
(
'like'
,
"%"
.
trim
(
$shopTagsArr
[
0
])
.
"%"
);
}
else
{
foreach
(
$shopTagsArr
as
$key
=>
$val
)
{
$spTagArr
[
'shop_sign'
][]
=
array
(
'like'
,
"%"
.
trim
(
$val
)
.
"%"
);
}
}
}
$order_
=
"id desc"
;
break
;
default
:
$this
->
response
(
"101"
,
"请求数据异常"
);
}
if
(
!
empty
(
$conditions
))
{
$conditions
[
'status'
]
=
array
(
'eq'
,
1
);
//只显示上架
if
(
$params
[
'site_area'
]
==
1
||
$params
[
'site_area'
]
==
2
)
$conditions
[
'is_show'
]
=
array
(
'eq'
,
0
);
//c端只显示可显示的楼盘
}
$result
=
$this
->
gHousesModel
->
getHousesList
(
$pageNo
,
$pageSize
,
$order_
,
$field
,
$conditions
,
$spTagArr
);
//获取图片信息
foreach
(
$result
as
$key
=>
$val
)
{
$result
[
$key
][
"api_path"
]
=
CK_IMG_URL
;
$param
[
"house_id"
]
=
$val
[
"id"
];
$param
[
"img_type"
]
=
1
;
//默认主图
$result
[
$key
][
"images"
]
=
$this
->
gHousesImgModel
->
getHouseImages
(
$param
,
1
);
}
if
(
empty
(
$result
))
{
return
$this
->
response
(
"200"
,
"此条件没有找到数据"
);
}
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
}
}
\ No newline at end of file
application/model/GHouses.php
View file @
ce34f5fe
This diff is collapsed.
Click to expand it.
application/model/GHousesImgs.php
View file @
ce34f5fe
<?php
namespace
app\model
;
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/1/19
* Time: 11:33
*/
use
think\Db
;
namespace
app\model
;
class
GHousesImgs
extends
BaseModel
...
...
@@ -176,4 +177,23 @@ class GHousesImgs extends BaseModel
$this
->
add
(
$params
,
$house_id
);
return
$this
->
saveAll
(
$house_img_edit
);
}
/****** zw start *******/
/**
* 查询图片
* @param $param
* @param $limit_
* @return mixed
*/
public
function
getHouseImages
(
$param
,
$limit_
)
{
//rank
return
Db
::
table
(
$this
->
table
)
->
field
(
"id,house_id,img_type,img_name,img_status"
)
->
where
(
$param
)
->
limit
(
$limit_
)
->
select
();
}
/****** zw end *******/
}
\ No newline at end of file
application/route.php
View file @
ce34f5fe
...
...
@@ -237,6 +237,9 @@ Route::group('broker', [
'agentsUnBind'
=>
[
'api_broker/CellPhone/agentsUnBind'
,
[
'method'
=>
'post'
]
],
//解除绑定关系
'callLog'
=>
[
'api_broker/CellPhone/callLog'
,
[
'method'
=>
'get'
]
],
//通话记录
'getShopList'
=>
[
'api_broker/Shop/getShopList'
,
[
'method'
=>
'get'
]
],
]);
//Route::miss('api/index/miss');//处理错误的url
\ 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