Commit 73a190f0 authored by hujun's avatar hujun

楼盘列表

parent 051093fa
This diff is collapsed.
...@@ -15,6 +15,9 @@ use app\index\service\OfficeService; ...@@ -15,6 +15,9 @@ use app\index\service\OfficeService;
class OfficeBuilding extends Basic class OfficeBuilding extends Basic
{ {
private $service; private $service;
private $code = 200;
private $msg = '';
private $data = [];
public function __construct() public function __construct()
{ {
...@@ -47,7 +50,8 @@ class OfficeBuilding extends Basic ...@@ -47,7 +50,8 @@ class OfficeBuilding extends Basic
* 办公楼详情 * 办公楼详情
* @return \think\Response * @return \think\Response
*/ */
public function getOfficeBuildingInfo(){ public function getOfficeBuildingInfo()
{
$params = $this->params; $params = $this->params;
$checkResult = $this->validate($params, "OfficeRoomValidate.getOfficeRoomInfo"); $checkResult = $this->validate($params, "OfficeRoomValidate.getOfficeRoomInfo");
if (true !== $checkResult) { if (true !== $checkResult) {
...@@ -58,6 +62,24 @@ class OfficeBuilding extends Basic ...@@ -58,6 +62,24 @@ class OfficeBuilding extends Basic
$id = $params['id']; $id = $params['id'];
$result = $s_office->getBuildingInfo($id); $result = $s_office->getBuildingInfo($id);
return $this->response($result['status'],$result['msg'], $result['data']); return $this->response($result['status'], $result['msg'], $result['data']);
}
/**
* 楼盘列表
*
* @return \think\Response
*/
public function getBuildingRoom()
{
$result = $this->service->getBuildingList($this->params);
if ($result['status'] == 'successful') {
$this->data = $result['data'];
} else {
$this->code = 101;
$this->msg = $result['msg'];
}
return $this->response($this->code, $this->msg, $this->data);
} }
} }
\ No newline at end of file
...@@ -17,6 +17,9 @@ use app\model\OfficeGBuilding; ...@@ -17,6 +17,9 @@ use app\model\OfficeGBuilding;
class OfficeRoom extends Basic class OfficeRoom extends Basic
{ {
private $service; private $service;
private $code = 200;
private $data = [];
private $msg = '';
public function __construct() public function __construct()
{ {
...@@ -34,14 +37,12 @@ class OfficeRoom extends Basic ...@@ -34,14 +37,12 @@ class OfficeRoom extends Basic
*/ */
public function delHouseFile() public function delHouseFile()
{ {
$msg = '';
$code = 200;
$result = $this->service->delHouseFile($this->params['id'], $this->params['house_id'], $this->params['save_path']); $result = $this->service->delHouseFile($this->params['id'], $this->params['house_id'], $this->params['save_path']);
if ($result['status'] == 'fail') { if ($result['status'] == 'fail') {
$code = 101; $this->code = 101;
$msg = '删除失败'; $this->msg = '删除失败';
} }
return $this->response($code, $msg); return $this->response($this->code, $this->msg);
} }
/** /**
...@@ -51,36 +52,33 @@ class OfficeRoom extends Basic ...@@ -51,36 +52,33 @@ class OfficeRoom extends Basic
*/ */
public function edit() public function edit()
{ {
$result['code'] = 200;
$result['msg'] = '';
$result_data = [];
if ($this->request->isPost()) { if ($this->request->isPost()) {
$data = $this->service->edit($this->params, $this->agentId, $this->siteId); $data = $this->service->edit($this->params, $this->agentId, $this->siteId);
if ($data['status'] == 'successful') { if ($data['status'] == 'successful') {
$result_data['house_id'] = $data['data']['house_id']; $this->data['house_id'] = $data['data']['house_id'];
$result['msg'] = '新增或编辑成功'; $this->msg = '新增或编辑成功';
} else { } else {
$result['code'] = 101; $this->code = 101;
$result['msg'] = $data['msg']; $this->msg = $data['msg'];
} }
} else { } else {
if (empty($this->params['id'])) { if (empty($this->params['id'])) {
$result['code'] = 101; $this->code = 101;
$result['msg'] = 'Id is null'; $this->msg = 'Id is null';
} else { } else {
//获取商铺详情 //获取商铺详情
$data = $this->service->getOfficeRoomDetail($this->params['id'], 1); $data = $this->service->getOfficeRoomDetail($this->params['id'], 1);
if ($data['status'] == 'successful') { if ($data['status'] == 'successful') {
$result_data = $data['data']; $this->data = $data['data'];
} else { } else {
$result['msg'] = $data['msg']; $this->msg = $data['msg'];
$result['code'] = 101; $this->code = 101;
} }
} }
} }
return $this->response($result['code'], $result['msg'], $result_data); return $this->response($this->code, $this->msg, $this->data);
} }
...@@ -114,22 +112,19 @@ class OfficeRoom extends Basic ...@@ -114,22 +112,19 @@ class OfficeRoom extends Basic
*/ */
public function getBuildingSearch() public function getBuildingSearch()
{ {
$msg = '';
$data = [];
$code = 200;
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$building_service = new OfficeService(); $building_service = new OfficeService();
$result = $building_service->BuildingSearch($pageNo, $pageSize, $this->params); $result = $building_service->BuildingSearch($pageNo, $pageSize, $this->params);
if ($result['status'] == 'fail') { if ($result['status'] == 'fail') {
$code = 101; $this->code = 101;
$msg = $result['msg']; $this->msg = $result['msg'];
} else { } else {
$data = $result['data']; $this->data = $result['data'];
} }
return $this->response($code, $msg, $data); return $this->response($this->code, $this->msg, $this->data);
} }
/** /**
...@@ -139,20 +134,30 @@ class OfficeRoom extends Basic ...@@ -139,20 +134,30 @@ class OfficeRoom extends Basic
*/ */
public function getBuildingDetail() public function getBuildingDetail()
{ {
$msg = '';
$data = [];
$code = 200;
$building_service = new OfficeService(); $building_service = new OfficeService();
$result = $building_service->getOfficeDetail($this->params['id']); $result = $building_service->getOfficeDetail($this->params['id']);
if ($result['status'] == 'fail') { if ($result['status'] == 'fail') {
$code = 101; $this->code = 101;
$msg = $result['msg']; $this->msg = $result['msg'];
} else { } else {
$data = $result['data']; $this->data = $result['data'];
} }
return $this->response($code, $msg, $data); return $this->response($this->code, $this->msg, $this->data);
} }
/**
* 楼盘房源列表
*
* @return \think\Response
*/
public function getList()
{
$result = $this->service->getRoomList($this->params);
if ($result['status'] == 'successful') {
$this->data = $result['data'];
}
return $this->result($this->code, $this->msg, $this->data);
}
} }
\ No newline at end of file
...@@ -259,7 +259,7 @@ class OfficeService ...@@ -259,7 +259,7 @@ class OfficeService
} }
$field = 'id,title,address,type,floor_total,business_district_id,intro'; $field = 'id,title,address,type,floor_total,business_district_id,intro';
$data = $this->m_office->getList($page_size, $page_no, '', $field, $where); $data = $this->m_office->getList($page_no, $page_size, '', $field, $where);
if ($is_total) { if ($is_total) {
$result['total'] = $this->m_office->getTotal($where); $result['total'] = $this->m_office->getTotal($where);
} }
...@@ -456,34 +456,104 @@ class OfficeService ...@@ -456,34 +456,104 @@ class OfficeService
return $res; return $res;
} }
public function getBuilding($params) /**
* @param $params
* @return array
*/
public function getBuildingList($params)
{ {
if (isset($params['title'])) { $page_no = empty($params['pageNo']) ? 1 : $params['pageNo'];
$where['title'] = ['LIKE', '%'.$params['title'].'%']; $page_size = empty($params['pageSize']) ? 15 : $params['pageSize'];
$where = [];
if (isset($params['city'])) {
$where['a.city'] = $params['city']; //市
} }
if (isset($params['disc'])) { if (isset($params['disc'])) {
$where['disc'] = $params['disc']; $where['a.disc'] = $params['disc']; //区
}
if (isset($params['title'])) {
$where['a.title'] = ['LIKE', '%'.$params['title'].'%']; //楼盘名
}
if (isset($params['id'])) {
$where['a.id'] = $params['id'];
} }
if (isset($params['`business_district_id`'])) { if (isset($params['`business_district_id`'])) {
$where['business_district_id'] = $params['business_district_id']; $where['a.business_district_id'] = $params['business_district_id']; //商圈id
}
if (isset($params['area_start'])) {
$where['b.area'] = ['>', $params['area_start']]; //面积
}
if (isset($params['area_end'])) {
$where['b.area'] = ['<', $params['area_end']]; //面积
}
if (isset($params['area_start']) && $params['area_end']) {
$where['b.area'] = ['between', [$params['area_start'], $params['area_end']]]; //面积
} }
if (isset($params['type'])) { if (isset($params['type'])) {
$where['type'] = $params['type']; $where['a.type'] = $params['type']; //1.写字楼 2商住两用 3园区 4.洋房 5联合办公 6厂房
} }
if (isset($params['id'])) { if (isset($params['price_start'])) {
$where['id'] = $params['id']; $where['b.price'] = $params['price_start']*100;//租金单价
} }
if (isset($params['city'])) { if (isset($params['price_end'])) {
$where['city'] = $params['city']; $where['b.price'] = $params['price_end']*100;//租金单价
} }
$field = 'id,title,address,type,floor_total,business_district_id,intro'; if (isset($params['price_start']) && isset($params['price_end'])) {
$data = $this->m_office->getList($page_size, $page_no, '', $field, $where); $where['b.price'] = ['between', [$params['price_start']*100, $params['price_end']*100]]; //租金单价
}
if (isset($params['is_exclusive_type'])) {
$where['b.is_exclusive_type'] = $params['is_exclusive_type']; //是否独家0否1是
}
if (isset($params['agent_start_time']) && $params['agent_end_time']) {
$where['b.agent_start_time'] = ['>', $params['agent_start_time']]; //独家合同开始时间
$where['b.agent_end_time'] = ['<', $params['agent_end_time']]; //独家合同结束时间
}
if (isset($params['is_rent'])) {
$where['b.is_rent'] = $params['is_rent']; //是否已租 0未租 1已租
}
if (isset($params['status'])) {
$where['a.status'] = $params['status']; //状态 1上架 2下架
}
if (isset($params['shop_sign'])) {
$where['b.shop_sign'] = ['like', '%'.$params['shop_sign'].'%']; //商铺标签
}
$field = 'a.id,a.disc,b.area,b.price,title,address,c.name as business_name,b.shop_sign,b.price_total';
try {
$data = $this->m_office->getBuildingRoom($page_no, $page_size, '', $field, $where);
} catch (\Exception $e) {
$result['status'] = 'fail';
$result['msg'] = $e->getMessage();
return $result;
}
$result_data = [];
foreach ($data as $k=>$v) {
$tmp['id'] = $v['id'];
$tmp['title'] = $v['disc'].' '.$v['business_name']. ' '.$v['title']. ' '.$v['area'].'㎡';
$tmp['price'] = $v['price']/100;
$tmp['price_total'] = $v['price_total']/100;
$tmp['shop_sign'] = empty($v['shop_sign']) ? '':$v['shop_sign'];
$result_data[] = $tmp;
}
$result['status'] = 'successful';
$result['data'] = $result_data;
return $result;
} }
} }
\ No newline at end of file
...@@ -119,6 +119,14 @@ class OfficeGBuilding extends BaseModel ...@@ -119,6 +119,14 @@ class OfficeGBuilding extends BaseModel
->find(); ->find();
} }
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBuildingInfo($field, $where) { public function getBuildingInfo($field, $where) {
$where['a.is_del'] = 0; $where['a.is_del'] = 0;
return $this->db_->field($field) return $this->db_->field($field)
...@@ -127,4 +135,29 @@ class OfficeGBuilding extends BaseModel ...@@ -127,4 +135,29 @@ class OfficeGBuilding extends BaseModel
->where($where) ->where($where)
->find(); ->find();
} }
/**
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBuildingRoom($pageNo = 1, $pageSize = 15, $order_ = 'a.id desc', $field = '', $params = '') {
$params['a.is_del'] = 0;
return $this->field($field)
->alias('a')
->join('office_g_room b', 'a.id = b.building_id', 'left')
->join('g_business_district c', 'a.business_district_id = c.id', 'left')
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->group('a.id')
->select();
}
} }
...@@ -408,7 +408,7 @@ class OfficeOMarchInModel extends Model ...@@ -408,7 +408,7 @@ class OfficeOMarchInModel extends Model
public function getMaxMarchInAgent($field, $where) { public function getMaxMarchInAgent($field, $where) {
return $this->alias('a') return $this->alias('a')
->field($field) ->field($field)
->join('o_order b', 'a.order_id = b.id', 'left') ->join('office_o_order b', 'a.order_id = b.id', 'left')
->where($where) ->where($where)
->group('a.reception_id ') ->group('a.reception_id ')
->find(); ->find();
......
...@@ -975,6 +975,7 @@ Route::group('office', [ ...@@ -975,6 +975,7 @@ Route::group('office', [
'filtrateConditionRoom' => ['api/shop/filtrateConditionRoom', ['method' => 'get | post']], 'filtrateConditionRoom' => ['api/shop/filtrateConditionRoom', ['method' => 'get | post']],
'addCollectHouse' => ['api_broker/OfficeCollectHouse/addCollectHouse', ['method' => 'POST|GET']], //收藏或取消收藏商铺 'addCollectHouse' => ['api_broker/OfficeCollectHouse/addCollectHouse', ['method' => 'POST|GET']], //收藏或取消收藏商铺
'getCollectHouseList' => ['api_broker/OfficeCollectHouse/getCollectHouseList', ['method' => 'POST|GET']], //查询收藏数据 'getCollectHouseList' => ['api_broker/OfficeCollectHouse/getCollectHouseList', ['method' => 'POST|GET']], //查询收藏数据
'getBuildingRoom' => ['api_broker/OfficeBuilding/getBuildingRoom', ['method' => 'POST|GET']], //楼盘列表
]); ]);
Route::group('office_index', [ Route::group('office_index', [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment