Commit f33d88af authored by hujun's avatar hujun

楼盘详情

parent 951ad470
......@@ -68,7 +68,7 @@ class OfficeRoom extends Basic
$result['msg'] = 'Id is null';
} else {
//获取商铺详情
$data = $this->service->getOfficeRoomDetail($this->params['id']);
$data = $this->service->getOfficeRoomDetail($this->params['id'], 1);
if ($data['status'] == 'successful') {
$result_data = $data['data'];
} else {
......
......@@ -12,6 +12,7 @@ namespace app\index\service;
use app\api_broker\service\PushMessageService;
use app\index\validate\OfficeBuildingRoomValidate;
use app\model\AAgents;
use app\model\OfficeGBuilding;
use app\model\OfficeGImg;
use app\model\OfficeGLandlordPhone;
use app\model\OfficeGOperatingRecord;
......@@ -24,7 +25,6 @@ class OfficeRoomService
private $validate;
private $m_office_room;
private $m_office_img;
private $m_building_stations;
private $push;
private $agent;
private $agent_room;
......@@ -209,37 +209,98 @@ class OfficeRoomService
}
try {
$field = 'id,building_id,is_show,province,city,disc,business_district_id,type,floor_total,longitude,latitude,intro';
$field = 'id,building_id,is_show,is_exclusive_type,is_rent,status,source,price_total,price,slotting_fee,';
$field .= 'management_fee,station_start,station_end,area,floor,room_number,floor_tag,enter_data,';
$field .= 'payment_month,deposit_month,age_limit_start,age_limit_end,is_register,is_partition,carport,decoration,';
$field .= 'enter_time,rent_free,shop_sign';
$data = $this->m_office_room->getFindData($field, ['id' => $id]);
if ($result) {
if ($data) {
/*案场,盘方,独家 start*/
$agents_data = $this->agent_room->getAgentsByRoomId('b.id,name,a.type,b.phone', ['house_id'=>$data['id']]);
$agents_str = $exclusive_str = $dish_str = '';
foreach ($agents_data as $k => $v) {
if ($v['type'] == 1) {
$agents_str .= $v['id'] . ',';
$data['agents_name'][] = $v['id'] . '-' . $v['name'] . '-' . $v['phone'];
$data['agents_name_arr'][] = [
'id' => $v['id'],
'name' => $v['name'],
'phone' => $v['phone'],
];
} elseif ($v['type'] == 2) {
$dish_str .= $v['id'] . ',';
$data['dish_name'][] = $v['id'] . '-' . $v['name'] . '-' . $v['phone'];
$data['dish_name_arr'][] = [
'id' => $v['id'],
'name' => $v['name'],
'phone' => $v['phone'],
];
} elseif ($v['type'] == 3) {
$exclusive_str .= $v['id'] . ',';
$data['exclusive_name'][] = $v['id'] . '-' . $v['name'] . '-' . $v['phone'];
$data['exclusive_name_arr'][] = [
'id' => $v['id'],
'name' => $v['name'],
'phone' => $v['phone'],
];
}
}
$data['agent_data'] = rtrim($agents_str, ',');
$data['agent_dish'] = rtrim($dish_str, ',');
$data['exclusive_ids'] = rtrim($exclusive_str, ',');
/*案场,盘方,独家 end*/
$img_data = $this->m_office_img->getListAll('id,img_type,img_name', ['building_id' => $id, 'img_type' => 0]);
/*图片 start*/
$img_data = $this->m_office_img->getListAll('id,img_type,img_name', ['house_id'=>$id]);
if ($app == 0) {
foreach ($img_data as $k => $v) {
$data['building_images'][$k]['img_name'] = $v['img_name'];
$data['building_images'][$k]['id'] = $v['id'];
switch ($v->img_type) {
case 1 :
$data['cover'] = $v->img_name;
break;
case 2 :
$data['slide_show'][$k]['img_name'] = $v['img_name'];
$data['slide_show'][$k]['id'] = $v['id'];
break;
case 3 :
$data['plan'][$k]['img_name'] = $v['img_name'];
$data['plan'][$k]['id'] = $v['id'];
break;
default :
$data['exclusive_img'][$k]['img_name'] = $v['img_name'];
$data['exclusive_img'][$k]['id'] = $v['id'];
}
}
} else {
$file_url = [];
foreach ($img_data as $k => $v) {
$img_url = CK_IMG_URL . 'images/' . $v->img_name;
$img_url = CK_IMG_URL . 'images/' . $v['img_name'];
$file_url['file_name'] = $img_url;
$file_url['save_path'] = $v['img_name'];
$data['building_images'][] = $file_url;
switch ($v->img_type) {
case 1 :
$data['cover'] = $file_url;
break;
case 2 :
$data['slide_show'][] = $file_url;
break;
case 3 :
$data['plan'][] = $file_url;
break;
default :
$data['exclusive_img'][] = $file_url;
}
}
}
/*图片 end*/
// if (!empty($data['business_district_id'])) {
// $business = new GBusinessDistrict();
// $data['business_name'] = $business->getValue(['id'=>$data['business_district_id']], 'name');
// } else {
// $data['business_name'] = "";
// }
$field_stations = 'a.id,b.line_name,name,distance,b.id as stations_id';
$data['building_stations'] = $this->m_building_stations->getListAll($field_stations, ['a.building_id' => $id]);
$office = new OfficeGBuilding();
$m_landlord = new OfficeGLandlordPhone();
$data['total'] = $office->getFieldOneValue('title', ['id'=>$data['building_id']]);
$data['landlord_phone_array'] = $m_landlord->getAllList('id,name,phone', ['house_id'=>$data['id']]);
}
$result['data'] = $data;
$result['status'] = 'successful';
......
......@@ -137,4 +137,19 @@ class OfficeGLandlordPhone extends BaseModel
return $this->db_->where($where)
->column($field);
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAllList($field, $where) {
$where['is_del'] = 0;
return $this->db_->field($field)
->where($where)
->select();
}
}
......@@ -171,11 +171,11 @@ class OfficeGRoom extends BaseModel
if (empty($data['id'])) {
$save_data['operation_id'] = $agent_id; //上传人
$save_data['create_time'] = date('Y-m-d H:i:s');
$room_id = $this->insertGetId($save_data);
$room_id = $this->db_->insertGetId($save_data);
} else {
try {
$save_data['update_time'] = date('Y-m-d H:i:s');
$this->where('id', $data['id'])->update($save_data);
$this->db_->where('id', $data['id'])->update($save_data);
$room_id = $data['id'];
} catch (\Exception $e) {
$room_id = 0;
......@@ -197,7 +197,7 @@ class OfficeGRoom extends BaseModel
*/
public function getFindData($field, $where)
{
return $this->field($field)
return $this->db_->field($field)
->where($where)
->find();
}
......
......@@ -127,10 +127,10 @@ class OfficeGRoomToAgent extends BaseModel
* User HuJun
* Date 19-5-31 上午10:49
*/
public function getAgentsByRoomId($field, $params)
public function getAgentsByRoomId($field, $params = [])
{
$params['a.is_del'] = 0;
return $this->field($field)
return $this->db_->field($field)
->alias("a")
->join("a_agents b", "a.agent_id = b.id", "left")
->where($params)
......
......@@ -963,7 +963,7 @@ Route::group('office', [
'getCommission' => ['api_broker/OfficeOrderLog/getCommission', ['method' => 'GET|POST']],
'isShowAdjustment' => ['api_broker/OfficeOrderLog/isShowAdjustment', ['method' => 'GET|POST']],
'addBargain' => ['api_broker/OfficeOrderLog/addBargain', ['method' => 'post']], //新增成交报告佣金(分佣提成)
'houseEdit' => ['api_broker/OfficeRoom/edit', ['method' => 'POST']],//楼盘字典新增和编辑
'houseEdit' => ['api_broker/OfficeRoom/edit', ['method' => 'POST|GET']],//楼盘字典新增和编辑
'delHouseFile' => ['index/OfficeRoom/delHouseFile', ['method' => 'POST']],//删除楼盘图片
]);
......@@ -972,6 +972,5 @@ Route::group('office_index', [
'houseDictionaryAdd' => ['index/OfficeManage/add', ['method' => 'GET|POST']],//楼盘字典新增
'houseDictionaryEdit' => ['index/OfficeManage/edit', ['method' => 'GET|POST']],//楼盘字典编辑
'delHouseFile' => ['index/OfficeManage/delHouseFile', ['method' => 'POST']],//删除楼盘图片
'delHouseFile' => ['index/OfficeManage/delHouseFile', ['method' => 'POST']],//删除楼盘图片
]);
//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