Commit 152e6d7d authored by hujun's avatar hujun

楼盘房源列表

parent 5a1c9757
...@@ -115,10 +115,28 @@ class OfficeRoom extends Basic ...@@ -115,10 +115,28 @@ class OfficeRoom extends Basic
return $this->response($code, $msg, $data); return $this->response($code, $msg, $data);
} }
/**
* 楼盘房源列表
*
* @return \think\Response
*/
public function getRoomList() public function getRoomList()
{ {
if (!$this->request->isAjax()) {
return view('');
}
$code = 200;
$data = [];
$msg = '';
$result = $this->service->getRoomList($this->params, 1);
if ($result['status'] == 'successful') {
$data['list'] = $result['data'];
$data['total'] = $result['total'];
} else {
$code = 101;
$msg = $result['msg'];
}
return $this->response($code, $msg, $data);
} }
} }
\ No newline at end of file
...@@ -13,6 +13,7 @@ use app\api_broker\service\PushMessageService; ...@@ -13,6 +13,7 @@ use app\api_broker\service\PushMessageService;
use app\api_broker\service\RedisCacheService; use app\api_broker\service\RedisCacheService;
use app\index\validate\OfficeBuildingRoomValidate; use app\index\validate\OfficeBuildingRoomValidate;
use app\model\AAgents; use app\model\AAgents;
use app\model\GBusinessDistrict;
use app\model\OfficeGBuilding; use app\model\OfficeGBuilding;
use app\model\OfficeGImg; use app\model\OfficeGImg;
use app\model\OfficeGLandlordPhone; use app\model\OfficeGLandlordPhone;
...@@ -335,10 +336,6 @@ class OfficeRoomService ...@@ -335,10 +336,6 @@ class OfficeRoomService
if ($data['management_fee'] > 0) { if ($data['management_fee'] > 0) {
$data['management_fee'] = $data['management_fee']/100; $data['management_fee'] = $data['management_fee']/100;
} }
if ($data['rent_free'] > 0) {
$data['rent_free'] = $data['rent_free']/100;
}
} }
$result['data'] = $data; $result['data'] = $data;
$result['status'] = 'successful'; $result['status'] = 'successful';
...@@ -794,13 +791,27 @@ class OfficeRoomService ...@@ -794,13 +791,27 @@ class OfficeRoomService
} }
} }
/*房东手机号搜索 end*/ /*房东手机号搜索 end*/
$field = 'a.id'; $field = 'a.id,b.type,b.disc,b.business_district_id,b.title,a.price_total,a.area,a.station_start,a.station_end,';
$field .= 'a.status,a.is_rent,a.is_show,a.create_time';
$result['data'] = $this->m_office_room->getRoomAgent($page_no, $page_size, $field, $where);
$room_data = $this->m_office_room->getRoomAgent($page_no, $page_size, $field, $where);
$m_business = new GBusinessDistrict();
foreach ($room_data as $k=>$v) {
$room_data[$k]['business_name'] = $m_business->getValue(['id'=>$v['business_district_id']], 'name');
$room_data[$k]['price_total'] = $room_data[$k]['price_total']/100;
$dish_name = $this->agent_room->getAgentsByRoomColumn('b.name', ['a.house_id'=>$v['id']]);
if (empty($dish_name)) {
$room_data[$k]['dish_name'] = '';
} else {
$room_data[$k]['dish_name'] = implode($dish_name, ',');
}
}
if ($is_total) { if ($is_total) {
$result['total'] = $this->m_office_room->getRoomAgentTotal($where); $result['total'] = $this->m_office_room->getRoomAgentTotal($where);
} }
$result['data'] = $room_data;
$result['status'] = 'successful';
}catch (\Exception $e) { }catch (\Exception $e) {
$result['msg'] = $e->getMessage(); $result['msg'] = $e->getMessage();
} }
......
...@@ -275,12 +275,13 @@ class OfficeGRoom extends BaseModel ...@@ -275,12 +275,13 @@ class OfficeGRoom extends BaseModel
{ {
return $this->alias('a') return $this->alias('a')
->field($field) ->field($field)
->join('office_g_room_to_agent b', 'a.id = b.house_id', 'left') ->join('office_g_building b', 'a.building_id = b.id', 'left')
->join('a_agents b', 'b.agent_id = b.id', 'left') ->join('office_g_room_to_agent c', 'a.id = c.house_id', 'left')
->join('office_g_building c', 'a.building_id = c.id', 'left') ->join('a_agents d', 'c.agent_id = d.id', 'left')
->where($where) ->where($where)
->limit($page_size) ->limit($page_size)
->page($page_no) ->page($page_no)
->group('a.id')
->select(); ->select();
} }
...@@ -299,10 +300,11 @@ class OfficeGRoom extends BaseModel ...@@ -299,10 +300,11 @@ class OfficeGRoom extends BaseModel
public function getRoomAgentTotal($where) public function getRoomAgentTotal($where)
{ {
return $this->alias('a') return $this->alias('a')
->join('office_g_room_to_agent b', 'a.id = b.house_id', 'left') ->join('office_g_building b', 'a.building_id = b.id', 'left')
->join('a_agents b', 'b.agent_id = b.id', 'left') ->join('office_g_room_to_agent c', 'a.id = c.house_id', 'left')
->join('office_g_building c', 'a.building_id = c.id', 'left') ->join('a_agents d', 'c.agent_id = d.id', 'left')
->where($where) ->where($where)
->group('a.id')
->count('a.id'); ->count('a.id');
} }
......
...@@ -147,10 +147,9 @@ class OfficeGRoomToAgent extends BaseModel ...@@ -147,10 +147,9 @@ class OfficeGRoomToAgent extends BaseModel
public function getAgentsByRoomColumn($field, $params = []) public function getAgentsByRoomColumn($field, $params = [])
{ {
$params['a.is_del'] = 0; $params['a.is_del'] = 0;
return $this->db_->field($field) return $this->db_->alias("a")
->alias("a")
->join("a_agents b", "a.agent_id = b.id", "left") ->join("a_agents b", "a.agent_id = b.id", "left")
->where($params) ->where($params)
->column(); ->column($field);
} }
} }
...@@ -984,6 +984,7 @@ Route::group('office_index', [ ...@@ -984,6 +984,7 @@ Route::group('office_index', [
'getBuildingDetail' => ['index/OfficeRoom/getBuildingDetail', ['method' => 'GET']],//楼盘详情 'getBuildingDetail' => ['index/OfficeRoom/getBuildingDetail', ['method' => 'GET']],//楼盘详情
'getBuildingList' => ['index/OfficeManage/getBuildingList', ['method' => 'GET']],//楼盘列表 'getBuildingList' => ['index/OfficeManage/getBuildingList', ['method' => 'GET']],//楼盘列表
'delBuilding' => ['index/OfficeManage/delBuilding', ['method' => 'GET']],//删除楼盘 'delBuilding' => ['index/OfficeManage/delBuilding', ['method' => 'GET']],//删除楼盘
'getRoomList' => ['index/OfficeRoom/getRoomList', ['method' => 'GET']],//删除楼盘
]); ]);
//Route::miss('api/index/miss');//处理错误的url //Route::miss('api/index/miss');//处理错误的url
\ No newline at end of file
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