Commit c2f5ce8f authored by clone's avatar clone

c端办公楼列表

parent 0295c66a
...@@ -4,7 +4,11 @@ namespace app\api\controller; ...@@ -4,7 +4,11 @@ namespace app\api\controller;
use app\api\extend\Basic; use app\api\extend\Basic;
use app\api\service\ActivityService; use app\api\service\ActivityService;
use app\api\service\OfficeRoomApiService;
use app\index\service\OfficeRoomService; use app\index\service\OfficeRoomService;
use app\model\MetroStations;
use app\model\OfficeGLabels;
use app\model\Regions;
use think\Request; use think\Request;
/** /**
...@@ -16,11 +20,13 @@ use think\Request; ...@@ -16,11 +20,13 @@ use think\Request;
class OfficeRoom extends Basic class OfficeRoom extends Basic
{ {
private $service; private $service;
private $serviceApi;
public function __construct(Request $request = null) public function __construct(Request $request = null)
{ {
parent::__construct($request); parent::__construct($request);
$this->service = new OfficeRoomService(); $this->service = new OfficeRoomService();
$this->serviceApi = new OfficeRoomApiService();
} }
...@@ -43,4 +49,117 @@ class OfficeRoom extends Basic ...@@ -43,4 +49,117 @@ class OfficeRoom extends Basic
return $this->response($result['status'],$result['msg'], $result['data']); return $this->response($result['status'],$result['msg'], $result['data']);
} }
/**
* 楼盘列表
*
* @return \think\Response
*/
public function getBuildingRoomList()
{
$result = $this->serviceApi->getRoomBuildingList($this->params);
if ($result['status'] == 'successful') {
return $this->response("200", "success",$result['data']);
} else {
return $this->response("101", $result['msg']);
}
}
/**
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function filtrateConditionRoom()
{
$params = $this->params;
if (empty($params["city"])) {
return $this->response("101", "参数错误");
}
$city = $params["city"];
$regions = new Regions();
$cityList = $regions->getRegionsByCity($city);
$i = $j = 0;
$result["area"][$i]["city"] = "全部";
$result["area"][$i]["disc"][] = "全部";
foreach ($cityList as $k => $v) {
$i++;
if (!empty($v["name"])) {
$result["area"][$i]["city"] = $v["name"];
$result["area"][$i]["disc"][] = "全" . $v["name"];
}
foreach ($v["city"] as $item) {
if (!empty($item)) {
$result["area"][$i]["disc"][] = $item;
}
}
if ($j == 0) {
$result["area"][$i]["business_district"][$j]['district'] = "全" . $v["name"];
$result["area"][$i]["business_district"][$j]['business'][] = [
'id' => 0, 'name' => '全部'
];
}
foreach ($v['business_district'] as $item2) {
if (!empty($item2)) {
$j++;
$result["area"][$i]["business_district"][$j] = $item2;
}
}
break;
}
$metroStations = new MetroStations();
$stationsParams["is_del"] = 0;
$stationsParams["province"] = array("like", trim($city) . "%");
$stationsField = "id,line_name,line_name_simple,name,province,city,latitude,longitude";
$stationsArr = $metroStations->getMetroStations($stationsField, $stationsParams);
$x = $y = 0;
$result["stations"][$x]["line"] = "全部";
$refer = array();
foreach ($stationsArr as $key => $value) {
$refer[$value["line_name_simple"]][] = $value;
}
foreach ($refer as $key => $data) {
$result["stations"][$x]["line"] = $key;
$result["stations"][$x]["name"] = $data;
$x++;
}
$result['yetai'] = array('全部', '商场美食', '沿街餐饮', '百货超市', '服饰鞋包', '亲子教育', '休闲娱乐', '办公', '其他');
//租金租金(0:租金-大于三万; 1:租金一万到三万之间; 2:租金-小于一万)
$result['money'] = array(
array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '3万以上'),
array('id' => '1', 'value' => '1万-3万'), array('id' => '2', 'value' => '1万以下')
);
//面积
$result['acreage'] = array(
array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '30m²以内'),
array('id' => '1', 'value' => '30-60m²'), array('id' => '2', 'value' => '60-100m²'), array('id' => '3', 'value' => '100-300m²')
, array('id' => '4', 'value' => '300-500m²'), array('id' => '5', 'value' => '500m²以上')
);
$result['more'][] = "全部";
$room_labels = new OfficeGLabels();
$labelsResult = $room_labels->getLabels();
if (count($labelsResult) > 0) {
foreach ($labelsResult as $labelsKey => $labelsVal) {
if ($labelsVal['name']) {
$result['more'][] = $labelsVal['name'];
}
}
}
return $this->response("200", "request success", $result);
}
} }
\ No newline at end of file
<?php
namespace app\api\service;
use app\model\OfficeGBuildingStations;
use app\model\OfficeGRoom;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/6/25
* Time: 10:31
*/
class OfficeRoomApiService
{
private $m_office_room;
public function __construct()
{
$this->m_office_room = new OfficeGRoom();
}
/**
* 办公楼列表
*
* @param $params
* @return array
*/
public function getRoomBuildingList($params)
{
$page_no = empty($params['pageNo']) ? 1 : $params['pageNo'];
$page_size = empty($params['pageSize']) ? 15 : $params['pageSize'];
$where = [];
$order = 'a.id desc';
if (isset($params['city'])) {
$where['b.city'] = $params['city']; //市
}
if (isset($params['disc'])) {
$where['b.disc'] = $params['disc']; //区
}
if (isset($params['title'])) {
$where['b.title'] = ['LIKE', '%' . $params['title'] . '%']; //楼盘名
}
if (isset($params['id'])) {
$where['a.id'] = $params['id'];
}
if (isset($params['`business_district_id`'])) {
$where['b.business_district_id'] = $params['business_district_id']; //商圈id
}
if (isset($params['area_start'])) {
$where['a.area'] = ['>', $params['area_start']]; //面积
}
if (isset($params['area_end'])) {
$where['a.area'] = ['<', $params['area_end']]; //面积
}
if (isset($params['area_start']) && $params['area_end']) {
$where['a.area'] = ['between', [$params['area_start'], $params['area_end']]]; //面积
}
if (isset($params['type'])) {
$where['b.type'] = $params['type']; //1.写字楼 2商住两用 3园区 4.洋房 5联合办公 6厂房
}
if (isset($params['price_start'])) {
$where['a.price'] = $params['price_start'] * 100;//租金单价
}
if (isset($params['price_end'])) {
$where['a.price'] = $params['price_end'] * 100;//租金单价
}
if (isset($params['price_start']) && isset($params['price_end'])) {
$where['a.price'] = ['between', [$params['price_start'] * 100, $params['price_end'] * 100]]; //租金单价
}
if (isset($params['shop_sign'])) {
$where['a.shop_sign'] = ['like', '%' . $params['shop_sign'] . '%']; //商铺标签
}
if (isset($params['stations_ids'])) {
$ids = $this->getBuildingByStations($params['stations_ids']);
if ($ids) {
$where['b.id'] = array("in", $ids); //地铁
}
}
$where['a.status'] = 1; //状态 1上架 2下架 只显示上架
$field = 'a.id,b.disc,b.title,b.address,c.name as business_name,a.building_id,a.price,a.price_total,b.status,a.is_rent';
try {
$data = $this->m_office_room->getRoomBuilding($page_no, $page_size, $order, $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['price'] = empty($v['price']) ? 0 : $v['price'] / 100;
$tmp['price_total'] = empty($v['price_total']) ? 0 : $v['price_total'] / 100;
$tmp['shop_sign'] = $this->getBuildingSign($v['building_id']);
$tmp['status'] = $v['status'];
$tmp['is_rent'] = $v['is_rent'];
$area = $this->MinField($v['building_id'], 'area');
$tmp['title'] = $v['disc'] . ' ' . $v['business_name'] . ' ' . $v['title'] . ' ' . $area . '㎡';
$result_data[] = $tmp;
}
$result['status'] = 'successful';
$result['data'] = $result_data;
return $result;
}
/**
* 标签处理
*
* @param $id
* @return string
*/
private function getBuildingSign($id)
{
$field = 'shop_sign';
$where['building_id'] = $id;
$where['status'] = 1;
$res = $this->m_office_room->getRoom($field, $where);
if (!$res)
return '';
$shop_sign_old = '';
foreach ($res as $k => $v) {
$shop_sign_old .= ',' . $v['shop_sign'];
}
$ex_shop_sign_old = explode(',', trim($shop_sign_old, ","));
$ex_shop_sign_old = array_unique($ex_shop_sign_old);//数组去重
$shop_sign = implode(",", $ex_shop_sign_old);
return $shop_sign;
}
//字段最低值
public function MinField($id, $field = '')
{
$where['building_id'] = $id;
$field_string = "min({$field}) as min";
return $this->m_office_room->getFieldOneValue($field_string, $where);
}
/**
* 根据地铁id获取字典id
* @param $stations_str
* @return string
*/
private function getBuildingByStations($stations_str)
{
$buildingStationsModel = new OfficeGBuildingStations();
$field = "building_id,stations_id";
$params["stations_id"] = array("in", $stations_str);
$buildingArr = $buildingStationsModel->getBuilderByStations($field, $params);
$ids = "";
if (count($buildingArr) > 0) {
foreach ($buildingArr as $item) {
$ids .= $item["id"] . ",";
}
$ids = rtrim($ids, ",");
}
return $ids;
}
}
...@@ -77,7 +77,7 @@ class OfficeGBuildingStations extends BaseModel ...@@ -77,7 +77,7 @@ class OfficeGBuildingStations extends BaseModel
* @throws \think\exception\PDOException * @throws \think\exception\PDOException
*/ */
public function updateData($data, $where) public function updateData($data, $where)
{ {
return $this->db_->where($where)->update($data); return $this->db_->where($where)->update($data);
} }
......
...@@ -352,7 +352,7 @@ Route::group('index', [ ...@@ -352,7 +352,7 @@ Route::group('index', [
'userModalList' => ['index/Member/userDetail', ['method' => 'GET']], //客户跟进模态框,公用 'userModalList' => ['index/Member/userDetail', ['method' => 'GET']], //客户跟进模态框,公用
'inspectionRecordList' => ['index/InspectionRecord/inspectionRecordList', ['method' => 'GET']],//约带看记录liu 'inspectionRecordList' => ['index/InspectionRecord/inspectionRecordList', ['method' => 'GET']],//约带看记录liu
'realtimePerformance' => ['index/RealTimePerformance/realtimePerformanceList', ['method' => 'GET']],//实时业绩liu 'realtimePerformance' => ['index/RealTimePerformance/realtimePerformanceList', ['method' => 'GET']],//实时业绩liu
'realtimePerformanceOffice' => ['index/RealTimePerformance/realtimePerformanceOfficeList', ['method' => 'GET']],//实时业绩liu办公楼 'realtimePerformanceOffice' => ['index/RealTimePerformance/realtimePerformanceOfficeList', ['method' => 'GET']],//实时业绩liu办公楼
'shopinspectionLog' => ['index/ShopInspectionLog/shopinspectionLogList', ['method' => 'POST|GET']],//商铺查看日志liu 'shopinspectionLog' => ['index/ShopInspectionLog/shopinspectionLogList', ['method' => 'POST|GET']],//商铺查看日志liu
'opensquareLog' => ['index/OpenSquareLog/opensquarelogList', ['method' => 'POST|GET']],//开盘广场liu 'opensquareLog' => ['index/OpenSquareLog/opensquarelogList', ['method' => 'POST|GET']],//开盘广场liu
'redEnvelope' => ['index/RedEnvelope/redEnvelopeList', ['method' => 'POST|GET']],//活动列表liu 'redEnvelope' => ['index/RedEnvelope/redEnvelopeList', ['method' => 'POST|GET']],//活动列表liu
...@@ -665,14 +665,14 @@ Route::group('task', [ ...@@ -665,14 +665,14 @@ Route::group('task', [
'rongStatusInformUrl' => ['task/PrivacyNumber/rongStatusInformUrl', ['method' => 'post | get']],//隐私号码回调[状态通知] 'rongStatusInformUrl' => ['task/PrivacyNumber/rongStatusInformUrl', ['method' => 'post | get']],//隐私号码回调[状态通知]
'defaultFollowUp' => ['task/PrivacyNumber/defaultFollowUp', ['method' => 'post | get']], //默认跟进 'defaultFollowUp' => ['task/PrivacyNumber/defaultFollowUp', ['method' => 'post | get']], //默认跟进
'callBackDownVoice' => ['task/PrivacyNumber/callBackDownVoice', ['method' => 'post | get']], //回调录音 'callBackDownVoice' => ['task/PrivacyNumber/callBackDownVoice', ['method' => 'post | get']], //回调录音
'getDownVoiceParams' => ['task/PrivacyNumber/getDownVoiceParams', ['method' => 'post | get']], //获取下载参数 'getDownVoiceParams' => ['task/PrivacyNumber/getDownVoiceParams', ['method' => 'post | get']], //获取下载参数
'downVoiceByParams' => ['task/PrivacyNumber/downVoiceByParams', ['method' => 'post | get']], //下载录音 'downVoiceByParams' => ['task/PrivacyNumber/downVoiceByParams', ['method' => 'post | get']], //下载录音
'updateDownVoiceId' => ['task/PrivacyNumber/updateDownVoiceId', ['method' => 'post | get']], //更新下载数据库 'updateDownVoiceId' => ['task/PrivacyNumber/updateDownVoiceId', ['method' => 'post | get']], //更新下载数据库
'updateShopTask' => ['task/JobTask/updateShopTask', ['method' => 'post | get']], //默认跟进 'updateShopTask' => ['task/JobTask/updateShopTask', ['method' => 'post | get']], //默认跟进
'updateShopImageIdTask' => ['task/JobTask/updateShopImageIdTask', ['method' => 'post | get']], //默认图片 'updateShopImageIdTask' => ['task/JobTask/updateShopImageIdTask', ['method' => 'post | get']], //默认图片
'image' => ['task/JobTask/image', ['method' => 'post | get']], //压缩图片 'image' => ['task/JobTask/image', ['method' => 'post | get']], //压缩图片
'updateShopAddress' => ['task/JobTask/updateShopAddress', ['method' => 'get']], //默认图片 'updateShopAddress' => ['task/JobTask/updateShopAddress', ['method' => 'get']], //默认图片
'updateShopAgeLimit' => ['task/JobTask/updateShopAgeLimit', ['method' => 'get']], //默认年限 'updateShopAgeLimit' => ['task/JobTask/updateShopAgeLimit', ['method' => 'get']], //默认年限
'push' => ['task/PushMessageTask/push', ['method' => 'get']], //推送和客户推送 'push' => ['task/PushMessageTask/push', ['method' => 'get']], //推送和客户推送
'updateLandlordLimit' => ['task/JobTask/updateLandlordLimit', ['method' => 'get']], //转换房东手机号 'updateLandlordLimit' => ['task/JobTask/updateLandlordLimit', ['method' => 'get']], //转换房东手机号
...@@ -1028,10 +1028,10 @@ Route::group('office', [ ...@@ -1028,10 +1028,10 @@ Route::group('office', [
'filtrateConditionRoom' => ['api_broker/OfficeRoom/filtrateConditionRoom', ['method' => 'get']], 'filtrateConditionRoom' => ['api_broker/OfficeRoom/filtrateConditionRoom', ['method' => 'get']],
'marchInListPcInfo' => ['api_broker/OfficePerformance/marchInListPcInfo', ['method' => 'POST|GET']],//进场 'marchInListPcInfo' => ['api_broker/OfficePerformance/marchInListPcInfo', ['method' => 'POST|GET']],//进场
'followListPcInfo' => ['api_broker/OfficePerformance/followListPcInfo', ['method' => 'POST|GET']],//报备 'followListPcInfo' => ['api_broker/OfficePerformance/followListPcInfo', ['method' => 'POST|GET']],//报备
'paylogListPcInfo' => ['api_broker/OfficePerformance/paylogListPcInfo', ['method' => 'POST|GET']],//收款 'paylogListPcInfo' => ['api_broker/OfficePerformance/paylogListPcInfo', ['method' => 'POST|GET']],//收款
'bargainSumPcInfo' => ['api_broker/OfficePerformance/bargainSumPcInfo', ['method' => 'POST|GET']],//成交 'bargainSumPcInfo' => ['api_broker/OfficePerformance/bargainSumPcInfo', ['method' => 'POST|GET']],//成交
'housingResourcePcInfo' => ['api_broker/OfficePerformance/housingResourcePcInfo', ['method' => 'POST|GET']],//新增商铺数(办公楼) 'housingResourcePcInfo' => ['api_broker/OfficePerformance/housingResourcePcInfo', ['method' => 'POST|GET']],//新增商铺数(办公楼)
...@@ -1122,7 +1122,7 @@ Route::group('office_index', [ ...@@ -1122,7 +1122,7 @@ Route::group('office_index', [
'checkReportAttache/:check_status' => ['index/OfficeBargain/checkReport', ['method' => 'post'], ['check_status' => 1]], //审核成交报告-第一级审核 'checkReportAttache/:check_status' => ['index/OfficeBargain/checkReport', ['method' => 'post'], ['check_status' => 1]], //审核成交报告-第一级审核
'checkReportManager/:check_status' => ['index/OfficeBargain/checkReport', ['method' => 'post'], ['check_status' => 2]], //审核成交报告-第二级审核 'checkReportManager/:check_status' => ['index/OfficeBargain/checkReport', ['method' => 'post'], ['check_status' => 2]], //审核成交报告-第二级审核
'checkReportMajordomo/:check_status' => ['index/OfficeBargain/checkReport', ['method' => 'post'], ['check_status' => 3]], //审核成交报告-第三级审核 'checkReportMajordomo/:check_status' => ['index/OfficeBargain/checkReport', ['method' => 'post'], ['check_status' => 3]], //审核成交报告-第三级审核
'partialCommissionList' => ['index/OfficeFinance/partialCommissionList', ['method' => 'get']], //分佣提成明细表 'partialCommissionList' => ['index/OfficeFinance/partialCommissionList', ['method' => 'get']], //分佣提成明细表
'performanceInfo' => ['index/OfficePerformanceInfo/performanceInfo', ['method' => 'GET|POST']],//业绩明细办公楼 'performanceInfo' => ['index/OfficePerformanceInfo/performanceInfo', ['method' => 'GET|POST']],//业绩明细办公楼
'selectDistrictPerformance' => ['index/OfficePerformance/selectDistrictPerformance', ['method' => 'GET|POST']],//区域业绩排行 'selectDistrictPerformance' => ['index/OfficePerformance/selectDistrictPerformance', ['method' => 'GET|POST']],//区域业绩排行
...@@ -1135,6 +1135,8 @@ Route::group('office_api', [ ...@@ -1135,6 +1135,8 @@ Route::group('office_api', [
'getBrokerV2' => ['api/OfficeBroker/indexV2', ['method' => 'get']], //获取当前商铺或街铺的经纪人评论信息列表 'getBrokerV2' => ['api/OfficeBroker/indexV2', ['method' => 'get']], //获取当前商铺或街铺的经纪人评论信息列表
'getOfficeRoomInfo' => ['api/OfficeRoom/getOfficeRoomInfo', ['method' => 'GET|POST']],//获取房源详情 'getOfficeRoomInfo' => ['api/OfficeRoom/getOfficeRoomInfo', ['method' => 'GET|POST']],//获取房源详情
'getBuildingRoomList' => ['api/OfficeRoom/getBuildingRoomList', ['method' => 'GET|POST']],//获取房源列表
'filtrateConditionRoom' => ['api/OfficeRoom/filtrateConditionRoom', ['method' => 'GET|POST']],//商圈地铁
'getOfficeBuildingInfo' => ['api/OfficeBuilding/getOfficeBuildingInfo', ['method' => 'GET|POST']],//办公楼详情 'getOfficeBuildingInfo' => ['api/OfficeBuilding/getOfficeBuildingInfo', ['method' => 'GET|POST']],//办公楼详情
]); ]);
......
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