Commit 604c6e6d authored by zhuwei's avatar zhuwei

1

parent 19f5f0f7
...@@ -44,7 +44,7 @@ class OfficeRoom extends Basic ...@@ -44,7 +44,7 @@ class OfficeRoom extends Basic
} }
$id = $params['id']; $id = $params['id'];
$result = $this->service->getOfficeRoomInfo($id,1,1); $result = $this->service->getOfficeRoomInfo($id,$this->userId,1);
return $this->response($result['status'],$result['msg'], $result['data']); return $this->response($result['status'],$result['msg'], $result['data']);
} }
......
...@@ -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\AttentionModel;
use app\model\GBusinessDistrict; use app\model\GBusinessDistrict;
use app\model\OfficeACollectHouse; use app\model\OfficeACollectHouse;
use app\model\OfficeGBuilding; use app\model\OfficeGBuilding;
...@@ -703,7 +704,7 @@ class OfficeRoomService ...@@ -703,7 +704,7 @@ class OfficeRoomService
//楼盘图 //楼盘图
$result['building_image'] = $this->getBuildingImage($result['building_id']); $result['building_image'] = $this->getBuildingImage($result['building_id']);
//是否被收藏 //是否被收藏
$result['is_collect'] = $this->isCollect($result['id'], $agent_id); $result['is_collect'] = $this->isCollect($result['id'], $agent_id,$type);
//是否可编辑 //是否可编辑
$result['is_can_edit'] = $this->isCanEdit($result['id'], $agent_id); $result['is_can_edit'] = $this->isCanEdit($result['id'], $agent_id);
//微信分享图 原来的随机图 //微信分享图 原来的随机图
...@@ -731,21 +732,42 @@ class OfficeRoomService ...@@ -731,21 +732,42 @@ class OfficeRoomService
//是否被收藏 //是否被收藏
private function isCollect($house_id, $agent_id) private function isCollect($house_id, $agent_id,$type)
{ {
$m_collect_room = new OfficeACollectHouse(); if($type == 1){
//是否被收藏 $is_collect = $this->isCollectToC($house_id,$agent_id);
$is_collect = 2; }else{
if ($agent_id) { $m_collect_room = new OfficeACollectHouse();
//先判断是否已经存在数据 //是否被收藏
$field = 'id,status'; $is_collect = 2;
$get_params['agents_id'] = $agent_id; if ($agent_id) {
$get_params['house_id'] = $house_id; //先判断是否已经存在数据
$res = $m_collect_room->getCollectHouse($field, $get_params); $field = 'id,status';
if ($res && ($res[0]['status'] == 1)) {//如果存在 $get_params['agents_id'] = $agent_id;
$is_collect = 1; $get_params['house_id'] = $house_id;
$res = $m_collect_room->getCollectHouse($field, $get_params);
if ($res && ($res[0]['status'] == 1)) {//如果存在
$is_collect = 1;
}
} }
} }
return $is_collect;
}
//C是否被收藏
private function isCollectToC($house_id,$user_id){
$m_attention = new AttentionModel();
$attention["user_id"] = array("eq", $user_id);
$attention["house_id"] = array("eq", $house_id);
$attention["is_del"] = array("eq", 0);
$attention["type"] = array("eq", 1);
$attResult = $m_attention->getAttentionByUserIdAndHouseId($attention);
$is_collect = 0;
if (count($attResult) > 0)
$is_collect = $attResult[0]['id'];
return $is_collect; return $is_collect;
} }
......
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