Commit 2ac5bd44 authored by zhuwei's avatar zhuwei

房源列表

parent 66275ad7
......@@ -32,6 +32,7 @@ class OfficeRoomService
private $agent;
private $agent_room;
private $landlord_phone;
private $internet_path;
public function __construct()
{
......@@ -42,6 +43,12 @@ class OfficeRoomService
$this->agent = new AAgents();
$this->agent_room = new OfficeGRoomToAgent();
$this->landlord_phone = new OfficeGLandlordPhone();
if (CURRENT_URL == 'https://api.tonglianjituan.com/') {
$this->internet_path = IMAGES_URL.'/resource/lib/Attachments/images/';
}else {
$this->internet_path = 'http://pre2.tonglianjituan.com/resource/lib/Attachments/images/';
}
}
/**
......@@ -676,6 +683,11 @@ class OfficeRoomService
$where['house_id'] = $id;
$where['img_type'] = 0;
$house_img_data = $this->m_office_img->getListAll('id,img_name', $where);
if($house_img_data){
foreach ($house_img_data as $k=>$v) {
$house_img_data[$k]['image_path'] = $this->internet_path.$v['img_name'];
}
}
return $house_img_data;
}
......@@ -689,6 +701,11 @@ class OfficeRoomService
$where['house_id'] = $id;
$where['img_type'] = 2;
$house_img_data = $this->m_office_img->getListAll('id,img_name', $where);
if($house_img_data){
foreach ($house_img_data as $k=>$v) {
$house_img_data[$k]['image_path'] = $this->internet_path.$v['img_name'];
}
}
return $house_img_data;
}
......
......@@ -351,14 +351,52 @@ class OfficeService
//标签
$result['building_sign'] = $this->getBuildingSign($id);
//房源列表
$result['room_list'] = $this->getRoomList($id);
return ['status'=>200,'msg'=>'success','data'=>$result];
}
/**
* 标签
* @param $id
* @return string
*/
//房源列表
private function getRoomList($id){
$m_office_room = new OfficeGRoom();
$field = "a.id,a.area,a.price_total,a.price,a.station_start,a.station_end,a.decoration";
$params["a.id"] = $id;
$res = $m_office_room->getRoomInfo($field, $params);
if($res){
foreach ($res as $k=>$v) {
$res[$k]['price_total'] = $v['price_total'] * 0.01;
$res[$k]['price'] = $v['price'] * 0.01;
$res[$k]['cover_image'] = $this->getCoverImage($v['id']);
}
}
return $res;
}
//房源封面图
private function getCoverImage($id){
if (CURRENT_URL == 'https://api.tonglianjituan.com/') {
$internet_path = IMAGES_URL.'/resource/lib/Attachments/images/';
}else {
$internet_path = 'http://pre2.tonglianjituan.com/resource/lib/Attachments/images/';
}
$where['img_status'] = 0;
$where['house_id'] = $id;
$where['img_type'] = 1;
$house_img_data = $this->m_office_img->getListAll('id,img_name', $where);
if($house_img_data){
foreach ($house_img_data as $k=>$v) {
$house_img_data[$k]['image_path'] = $internet_path.$v['img_name'];
}
}
return $house_img_data;
// return $house_img_data[0]['img_name'];
}
//标签
private function getBuildingSign($id){
$m_office_room = new OfficeGRoom();
$field = 'shop_sign';
......@@ -377,12 +415,7 @@ class OfficeService
return $shop_sign;
}
/**
* 最大最小面积
* @param $id
* @param $type
* @return int
*/
//最大最小面积
private function getAreaMaxOrMin($id,$type){
$m_office_room = new OfficeGRoom();
$field = 'MAX(area) as num';
......@@ -396,11 +429,7 @@ class OfficeService
return $reference_average_price;
}
/**
* 轮播图
* @param $id
* @return string
*/
//轮播图
private function getCarouselImage($id){
$where['img_status'] = 0;
$where['house_id'] = $id;
......@@ -409,20 +438,13 @@ class OfficeService
return $house_img_data;
}
/**
* 交通信息
* @param $id
* @return string
*/
//交通信息
private function getTrafficInfo($id){
$res = '8号线地铁站出站300米';
return $res;
}
/**
* 房源数
* @return int|string
*/
//房源数
private function getRoomNum($id){
$m_office_room = new OfficeGRoom();
$params['building_id'] = $id;
......
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