Commit 6b0c16fb authored by zhuwei's avatar zhuwei

房源详情

parent 51ebedcb
...@@ -10,6 +10,7 @@ namespace app\index\service; ...@@ -10,6 +10,7 @@ namespace app\index\service;
use app\api_broker\service\PushMessageService; use app\api_broker\service\PushMessageService;
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\OfficeGBuilding; use app\model\OfficeGBuilding;
...@@ -579,17 +580,76 @@ class OfficeRoomService ...@@ -579,17 +580,76 @@ class OfficeRoomService
$conditions['a.id'] = $params["id"]; $conditions['a.id'] = $params["id"];
$field = 'a.id'; $field = 'a.id,b.title,a.price_total,a.price,a.station_start,b.type,a.station_end,a.area,a.floor,a.floor_tag,is_register
,a.age_limit_start,a.age_limit_end,a.rent_free,a.management_fee,a.slotting_fee,a.carport,a.enter_date,a.is_partition
,a.decoration,a.payment_month,a.deposit_month,a.source,a.create_time,a.operation_id,a.landlord_remark,a.fee_rule,
a.update_time,b.address';
$result = $this->m_office_room->getOfficeRoomInfo($field, $conditions); $result = $this->m_office_room->getOfficeRoomInfo($field, $conditions);
if (!$result) { if (!$result) {
return ['status'=>101,'msg'=>'此房源不存在']; return ['status'=>101,'msg'=>'此房源不存在'];
} }
#上传人
$result['upload_info'] = $this->getUploadInfo($result['operation_id']);
#独家方
$result['exclusive_info'] = $this->getExclusiveInfo($result['id']);
#房东
$result['landlord_info'] = $this->getLandlordInfo($result['id']);
return ['status'=>200,'msg'=>'success','data'=>$result]; return ['status'=>200,'msg'=>'success','data'=>$result];
} }
/** /**
* 获取上传人信息
* @param $agent_id
* @return array
*/
public function getUploadInfo($agent_id){
$agent = [];
$redis_service = new RedisCacheService();
$res = $redis_service->getRedisCache(2, $agent_id);
if($res)
$agent['name'] = $res['name'];
$agent['phone'] = $res['phone'];
return $agent;
}
/**
* 获取独家方
* @param $house_id
* @return array
*/
public function getExclusiveInfo($house_id){
$exclusive_info = [];
$params['house_id'] = $house_id;
$params['type'] = 3;
$params['is_del'] = 0;
$res = $this->agent_room->getAgentsByRoomId('b.id,name,a.type,b.phone', $params);
if($res)
$exclusive_info['name'] = $res['name'];
$exclusive_info['phone'] = $res['phone'];
return $exclusive_info;
}
/**
* 房东
* @param $house_id
* @return array
*/
public function getLandlordInfo($house_id){
$m_landlord = new OfficeGLandlordPhone();
$landlord_info = [];
$res = $m_landlord->getAllList('id,name,phone', ['house_id'=>$house_id]);;
if($res)
$landlord_info['id'] = $res['id'];
$landlord_info['name'] = $res['name'];
$landlord_info['phone'] = $res['phone'];
return $landlord_info;
}
/*
* @param $params * @param $params
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
......
...@@ -231,6 +231,7 @@ class OfficeGRoom extends BaseModel ...@@ -231,6 +231,7 @@ class OfficeGRoom extends BaseModel
{ {
$result = $this->field($field) $result = $this->field($field)
->alias("a") ->alias("a")
->join('office_g_building b', 'a.building_id=b.id','left')
->where($params) ->where($params)
->find(); ->find();
return $result; return $result;
......
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