Commit 4f615d85 authored by hujun's avatar hujun

save

parent 35bb2969
......@@ -212,9 +212,9 @@ class OfficeRoomService
try {
$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 .= 'management_fee,station_start,station_end,area,floor,room_number,floor_tag,enter_date,';
$field .= 'payment_month,deposit_month,age_limit_start,age_limit_end,is_register,is_partition,carport,decoration,';
$field .= 'enter_time,rent_free,shop_sign';
$field .= 'rent_free,shop_sign';
$data = $this->m_office_room->getFindData($field, ['id' => $id]);
if ($data) {
......@@ -300,9 +300,21 @@ class OfficeRoomService
$office = new OfficeGBuilding();
$m_landlord = new OfficeGLandlordPhone();
$data['title'] = $office->getFieldOneValue('title', ['id'=>$data['building_id']]);
$data['landlord_phone_array'] = $m_landlord->getAllList('id,name,phone', ['house_id'=>$data['id']]);
if (empty($data['building_id'])) {
$data['title'] = '';
$data['landlord_phone_array'] = $data['building_data'] = [];
} else {
$data['title'] = $office->getFieldOneValue('title', ['id'=>$data['building_id']]);
$data['landlord_phone_array'] = $m_landlord->getAllList('id,name,phone', ['house_id'=>$data['id']]);
$building_service = new OfficeService();
$building_data = $building_service->BuildingSearch(1, 100, ['id'=>$data['building_id']]);
if ($building_data['status'] != 'fail') {
$data['building_data'] = $building_data['data'];
} else {
$data['building_data'] = [];
}
}
}
$result['data'] = $data;
$result['status'] = 'successful';
......@@ -590,19 +602,55 @@ class OfficeRoomService
$page_no = empty($params['pageNo']) ? 1 : $params['pageNo'];
$page_size = empty($params['pageSize']) ? 15 : $params['pageSize'];
/*房东手机号搜索*/
$where = $this->buildParams($params);
/*盘方 start*/
if ($params['dish_id'] != NULL) {
$agent_where['a.agents_id'] = $params['dish_id'];
$agent_where['a.type'] = 2;
$agent_where['a.is_del'] = 0;
}
if ($params['dish_store_id'] != NULL) {
$agent_where['b.store_id'] = $params['dish_store_id'];
$agent_where['a.type'] = 2;
$agent_where['a.is_del'] = 0;
}
if ($params['dish_district_id'] != NULL) {
$agent_where['b.district_id'] = $params['dish_district_id'];
$agent_where['a.type'] = 2;
$agent_where['a.is_del'] = 0;
}
//盘方搜索
if (!empty($agent_where)) {
$agent_arr = $this->agent_room->getAgentsByRoomColumn('houses_id', $agent_where);
if (empty($agent_arr)) {
$data['data']['list'] = [];
$data['data']['total'] = 0;
return $this->response(200, '', $data);
} else {
$agent_str = implode(',', $agent_arr);
$where[] = ['EXP', "id in ({$agent_str})"];
}
}
/*盘方 end*/
/*房东手机号搜索 start*/
if ($params['landlord_phone'] != NULL) {
if (strlen($params['landlord_phone']) != 11) {
return $this->response(101, '房东手机不足11位');
$result['msg'] = '房东手机不足11位';
return $result;
}
$landlord_where['phone'] = ['LIKE','%'.$this->params['landlord_phone'].'%'];
$landlord_where['phone'] = ['LIKE','%'.$params['landlord_phone'].'%'];
$landlord_where['status'] = 0;
$landlord_arr = $this->landlord_phone->getList(1,1000, '', 'house_id', $landlord_where);
if (empty($landlord_arr)) {
$data['data']['list'] = [];
$data['data']['total'] = 0;
return $this->response(200, '', $data);
$result['status'] = 'successful';
return $result;
} else {
$landlord_house_id = [];
foreach ($landlord_arr as $k=>$v) {
......@@ -612,19 +660,143 @@ class OfficeRoomService
$where[] = ['EXP', "id in ({$landlord_str})"];
}
}
/*房东手机号搜索 end*/
$field = '';
$this->m_office_room->getRoomAgent($page_no, $page_size, $field, $where);
}
/**
* 条件构建
*
* @param $params
* @return array
* User HuJun
* Date 19-6-2 下午4:21
*/
private function buildParams($params) {
$where = [];
/*所在区*/
if (!empty($params['disc'])) {
$where['disc'] = $params['disc'];
if (isset($params['disc'])) {
$where['a.disc'] = $params['disc'];
}
/*所在市*/
if (!empty($params['city'])) {
$where['city'] = $params['city'];
if (isset($params['city'])) {
$where['a.city'] = $params['city'];
}
$this->m_office_room->getRoomAgent($page_no, $page_size);
}
/*商圈*/
if (isset($params['business_district_id'])) {
$where['c.business_district_id'] = $params['business_district_id'];
}
/*状态 1上架 2下架*/
if (isset($params['status'])) {
$where['a.status'] = $params['status'];
}
/*是否已租 0未租 1已租*/
if (isset($params['is_rent'])) {
$where['a.is_rent'] = $params['is_rent'];
}
/*是否已租 0未租 1已租*/
if (isset($params['area_start'])) {
$where['a.area_start'] = $params['area_start'];
}
/*是否已租 0未租 1已租*/
if (isset($params['area_end'])) {
$where['a.area_end'] = $params['area_end'];
}
/*是否已租 0未租 1已租*/
if (isset($params['area_end']) && isset($params['area_start'])) {
$where['a.area_end'] = ['between', [$params['area_start'], $params['area_end']]];
}
/*租金总价*/
if (isset($params['price_total_start'])) {
$where['a.price_total'] = $params['price_total_start'];
}
/*租金总价*/
if (isset($params['price_total_end'])) {
$where['a.price_total_end'] = $params['price_total_end'];
}
/*租金总价*/
if (isset($params['price_total_end']) && isset($params['price_total_start'])) {
$where['a.area_end'] = ['between', [$params['price_total_start'], $params['price_total_end']]];
}
/*租金单价*/
if (isset($params['price_start'])) {
$where['a.price'] = $params['price_start'];
}
/*租金单价*/
if (isset($params['price_end'])) {
$where['a.price_total_end'] = $params['price_end'];
}
/*租金单价*/
if (isset($params['price_end']) && isset($params['price_start'])) {
$where['a.area_end'] = ['between', [$params['price_start'], $params['price_end']]];
}
/*可容纳工位*/
if (isset($params['station_start'])) {
$where['a.station_start'] = $params['station_start'];
}
/*可容纳工位*/
if (isset($params['station_end'])) {
$where['a.station_end'] = $params['price_end'];
}
/*可容纳工位*/
if (isset($params['station_end']) && isset($params['price_start'])) {
$where['a.area_end'] = ['between', [$params['station_start'], $params['station_end']]];
}
//编号
if (isset($params['id'])) {
$where['a.id'] = $params['id'];
}
//地址
if (isset($params['address'])) {
$where['a.address'] = ['like', '%'.$params['address'].'%'];
}
//是否独家0否1是
if (isset($params['is_exclusive_type'])) {
$where['a.is_exclusive_type'] = $params['id'];
}
//楼盘名称
if (isset($params['title'])) {
$where['c.title'] = $params['title'];
}
/*创建时间*/
if (isset($params['create_time_start'])) {
$where['a.create_time'] = $params['create_time_start'];
}
/*创建时间*/
if (isset($params['create_time_end'])) {
$where['a.create_time'] = $params['create_time_end'];
}
/*创建时间*/
if (isset($params['create_time_start']) && isset($params['create_time_end'])) {
$where['a.create_time'] = ['between', [$params['create_time_start'], $params['create_time_end']]];
}
return $where;
}
}
\ No newline at end of file
......@@ -226,8 +226,8 @@ class OfficeService
{
$result['status'] = 'fail';
$result['msg'] = '';
if (empty($params['city'])) {
$where = [];
if (empty($params['city']) && empty($params['id'])) {
$result['msg'] = '参数错误';
return $result;
}
......@@ -252,10 +252,12 @@ class OfficeService
$where['id'] = $params['id'];
}
if (isset($params['city'])) {
$where['city'] = $params['city'];
}
$field = 'id,title,address,type,floor_total,business_district_id,intro';
$where['city'] = $params['city'];
$data = $this->m_office->getList($page_size, $page_no, '', $field, $where);
if ($is_total) {
$result['total'] = $this->m_office->getTotal($where);
}
......@@ -268,11 +270,13 @@ class OfficeService
}
$traffic = $this->m_building_stations->getListAll($traffic_field, ['building_id'=>$v['id']]);
$traffic_arr = [];
if ($traffic) {
$data[$k]['traffic'] = $traffic;
} else {
$data[$k]['traffic'] = '';
foreach ($traffic as $kk=>$vv) {
$traffic_arr[] = $vv['line_name_simple'].$vv['name'].'出站口距离'.$vv['distance'].'米';
}
}
$data[$k]['traffic'] = $traffic_arr;
}
$result['data'] = $data;
$result['status'] = 'successful';
......
......@@ -22,7 +22,7 @@ class OfficeBuildingRoomValidate extends Validate
'is_exclusive_type' => 'require|in:0,1',
'price_total' => 'require|between: 1,99999999',
'price' => 'require|between: 1,99999999',
'slotting_fee' => 'require|between: 1,99999999',
'slotting_fee' => 'require|between: 0,99999999',
'management_fee' => 'require|between: 1,99999999',
'station_start' => 'require|between: 1,99999',
'station_end' => 'require|between: 1,99999',
......@@ -37,7 +37,7 @@ class OfficeBuildingRoomValidate extends Validate
'carport' => 'require|length:1,255',
'rent_free' => 'require|length:-1,99',
'source' => 'require|in:0,1,2,3,4,5,6,7',
'is_show' => 'require|in:0,1',
// 'is_show' => 'require|in:0,1',
'decoration' => 'require|in:1,2,3,4',
'shop_sign' => 'require|length:1,255',
'landlord_phone'=>'require',
......@@ -86,8 +86,8 @@ class OfficeBuildingRoomValidate extends Validate
'rent_free.length' => '免租时间要在1至99个字',
'source.require' => '来源为必填',
'source.length' => '来源参数错误',
'is_show.require'=>'是否对客户展示必填',
'is_show.between'=>'是否对客户展示参数错误',
// 'is_show.require'=>'是否对客户展示必填',
// 'is_show.between'=>'是否对客户展示参数错误',
'decoration.require'=>'交付装修必填',
'decoration.between'=>'交付装修参数错误',
'shop_sign.require' => '商铺标签为必填',
......@@ -99,10 +99,10 @@ class OfficeBuildingRoomValidate extends Validate
protected $scene = [
'add' => ['floor','room_number','is_rent','is_exclusive_type','price_total','price','slotting_fee','management_fee',
'station_start','station_end','area','floor_tag','enter_time','payment_month','deposit_month','age_limit_start',
'age_limit_end','is_partition','carport','rent_free','source','is_show','decoration','shop_sign'],
'age_limit_end','is_partition','carport','rent_free','source','decoration','shop_sign'],
'edit' => ['id','floor','room_number','is_rent','is_exclusive_type','price_total','price','slotting_fee','management_fee',
'station_start','station_end','area','floor_tag','enter_time','payment_month','deposit_month','age_limit_start',
'age_limit_end','is_partition','carport','rent_free','source','is_show','decoration','shop_sign'],
'age_limit_end','is_partition','carport','rent_free','source','decoration','shop_sign'],
'detail' => ['id']
];
}
\ No newline at end of file
......@@ -254,6 +254,7 @@ class OfficeGRoom extends BaseModel
->field($field)
->join('office_g_room_to_agent b', 'a.id = b.house_id', 'left')
->join('a_agents b', 'b.agent_id = b.id', 'left')
->join('office_g_building c', 'a.building_id = c.id', 'left')
->where($where)
->limit($page_size)
->page($page_no)
......
......@@ -136,4 +136,21 @@ class OfficeGRoomToAgent extends BaseModel
->where($params)
->select();
}
/**
* @param $field
* @param array $params
* @return array
* User HuJun
* Date 19-6-2 下午4:25
*/
public function getAgentsByRoomColumn($field, $params = [])
{
$params['a.is_del'] = 0;
return $this->db_->field($field)
->alias("a")
->join("a_agents b", "a.agent_id = b.id", "left")
->where($params)
->column();
}
}
......@@ -964,7 +964,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']],//楼盘字典新增和编辑
'houseAdd' => ['api_broker/OfficeRoom/edit', ['method' => 'POST']],//楼盘字典新增和编辑
'delHouseFile' => ['api_broker/OfficeRoom/delHouseFile', ['method' => 'POST']],//删除房源图片
'delBuildingFile' => ['api_broker/OfficeBuilding/delHouseFile', ['method' => 'POST']],//删除楼盘图片
......
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