Commit 1bf0685c authored by hujun's avatar hujun

搜索楼号

parent 2ef192a7
...@@ -325,4 +325,22 @@ class OfficeRoom extends Basic ...@@ -325,4 +325,22 @@ class OfficeRoom extends Basic
return $this->response("200", 'request success', $result); return $this->response("200", 'request success', $result);
} }
/**
* 检查重盘
*
* @return \think\Response
*/
public function checkRepetition()
{
$result = $this->service->checkRepetition($this->params);
if ($result['status'] == 'fail') {
$this->code = 101;
$this->msg = $result['msg'];
} else {
$this->data = $result['data'];
}
return $this->response($this->code, $this->msg, $this->data);
}
} }
\ No newline at end of file
...@@ -64,6 +64,7 @@ class Basic extends Controller ...@@ -64,6 +64,7 @@ class Basic extends Controller
"broker/getShopListByMap", "broker/getShopListByMap",
"broker/getUserLabels", "broker/getUserLabels",
"office/filtrateConditionRoom", "office/filtrateConditionRoom",
"office/getHouseAddress",
); );
/** /**
......
...@@ -303,4 +303,22 @@ class OfficeRoom extends Basic ...@@ -303,4 +303,22 @@ class OfficeRoom extends Basic
} }
return $this->response($this->code, $this->msg, $this->data); return $this->response($this->code, $this->msg, $this->data);
} }
/**
* 检查重盘
*
* @return \think\Response
*/
public function checkRepetition()
{
$result = $this->service->checkRepetition($this->params);
if ($result['status'] == 'fail') {
$this->code = 101;
$this->msg = $result['msg'];
} else {
$this->data = $result['data'];
}
return $this->response($this->code, $this->msg, $this->data);
}
} }
\ No newline at end of file
...@@ -1491,4 +1491,45 @@ class OfficeRoomService ...@@ -1491,4 +1491,45 @@ class OfficeRoomService
} }
return $result; return $result;
} }
/**
* 是否重盘
*
* @param $params
* @return mixed
*/
public function checkRepetition($params) {
$result['status'] = 'fail';
$result['msg'] = '';
$result['data'] = [];
$check = $this->validate->scene('checkRepetition')->check($params);
if (false === $check) {
$result['msg'] = $this->validate->getError();
return $result;
}
$page_no = empty($params['pageNo']) ? 1 : $params['pageNo'];
$page_size = empty($params['pageSize']) ? 15 : $params['pageSize'];
try {
$field = 'a.id,a.floor,a.room_number,a.mansion';
$where['b.city'] = $params['city'];
$where['a.floor'] = $params['floor'];
$where['a.mansion'] = $params['mansion'];
$list = $this->m_office_room->getRoomBuildingListLimit($page_no, $page_size, $field, $where);
if ($list) {
$data = [];
foreach ($list as $k=>$v) {
$data[$k]['id'] = $v['id'];
$data[$k]['address'] = $v['mansion'].'-'.$v['floor'].'-'.$v['room_number'];
}
$result['data'] = $data;
}
$result['status'] = 'successful';
} catch (\Exception $e) {
$result['msg'] = "内部错误:".$e->getMessage();
}
return $result;
}
} }
\ No newline at end of file
...@@ -46,7 +46,8 @@ class OfficeBuildingRoomValidate extends Validate ...@@ -46,7 +46,8 @@ class OfficeBuildingRoomValidate extends Validate
'agent_start_time' => 'require', 'agent_start_time' => 'require',
'agent_end_time' => 'require', 'agent_end_time' => 'require',
'title'=>'require', 'title'=>'require',
'mansion'=>'require|length:2,255' 'mansion'=>'require|length:2,255',
'city'=>'require|length:2,10'
]; ];
protected $message = [ protected $message = [
...@@ -108,6 +109,8 @@ class OfficeBuildingRoomValidate extends Validate ...@@ -108,6 +109,8 @@ class OfficeBuildingRoomValidate extends Validate
'title.require'=>'楼盘字段标题必传', 'title.require'=>'楼盘字段标题必传',
'mansion.require'=>'楼号/栋/座必传', 'mansion.require'=>'楼号/栋/座必传',
'mansion.length' => '楼号/栋/座字数要在2至255之间', 'mansion.length' => '楼号/栋/座字数要在2至255之间',
'city.require'=>'城市必填',
'city.length'=>'城市长度不正确'
]; ];
protected $scene = [ protected $scene = [
...@@ -121,6 +124,7 @@ class OfficeBuildingRoomValidate extends Validate ...@@ -121,6 +124,7 @@ class OfficeBuildingRoomValidate extends Validate
'is_carefully_chosen' => ['id', 'is_carefully_chosen'], 'is_carefully_chosen' => ['id', 'is_carefully_chosen'],
'exclusive' => ['agent_start_time,agent_end_time,is_exclusive_type,id'], 'exclusive' => ['agent_start_time,agent_end_time,is_exclusive_type,id'],
'del'=>['id'], 'del'=>['id'],
'show' => 'id,is_show' 'show' => 'id,is_show',
'checkRepetition'=>'city,mansion,floor,room_number'
]; ];
} }
\ No newline at end of file
...@@ -454,6 +454,29 @@ class OfficeGRoom extends BaseModel ...@@ -454,6 +454,29 @@ class OfficeGRoom extends BaseModel
->find(); ->find();
} }
/**
* @param int $pageNo
* @param int $pageSize
* @param $field
* @param $params
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
function getRoomBuildingListLimit($pageNo = 1, $pageSize = 15, $field, $params, $order = 'a.id desc')
{
return $data = $this->field($field)
->alias("a")
->join("office_g_building b","a.building_id=b.id","left")
->where($params)
->order($order)
->limit($pageSize)
->page($pageNo)
->select();
}
/** /**
* @param $field * @param $field
* @param $params * @param $params
......
...@@ -1007,6 +1007,7 @@ Route::group('office', [ ...@@ -1007,6 +1007,7 @@ Route::group('office', [
'collectionListByBargainId' => [ 'api_broker/OfficePerformance/collectionListByBargainId', [ 'method' => 'POST|GET' ] ], 'collectionListByBargainId' => [ 'api_broker/OfficePerformance/collectionListByBargainId', [ 'method' => 'POST|GET' ] ],
'getOfficeRoomByReport' => [ 'api_broker/OfficeRoom/getOfficeRoomByReport', [ 'method' => 'get|post' ] ], 'getOfficeRoomByReport' => [ 'api_broker/OfficeRoom/getOfficeRoomByReport', [ 'method' => 'get|post' ] ],
'followUpLog' => [ 'api_broker/OfficeUser/followUpLog', [ 'method' => 'get|post' ] ], 'followUpLog' => [ 'api_broker/OfficeUser/followUpLog', [ 'method' => 'get|post' ] ],
'getHouseAddress' => ['api_broker/OfficeRoom/checkRepetition', ['method' => 'get']], //搜索楼号/栋/座+楼层+房号
]); ]);
...@@ -1054,6 +1055,7 @@ Route::group('office_index', [ ...@@ -1054,6 +1055,7 @@ Route::group('office_index', [
'inspectionRecordDistrict/:check_status' => ['index/OfficeReport/inspectionRecordAll', ['method' => 'GET'], ['check_status' => 2]], //部门约带看 'inspectionRecordDistrict/:check_status' => ['index/OfficeReport/inspectionRecordAll', ['method' => 'GET'], ['check_status' => 2]], //部门约带看
'inspectionRecordAll/:check_status' => ['index/OfficeReport/inspectionRecordAll', ['method' => 'GET'], ['check_status' => 3]], //全部约带看 'inspectionRecordAll/:check_status' => ['index/OfficeReport/inspectionRecordAll', ['method' => 'GET'], ['check_status' => 3]], //全部约带看
'getDistance' => ['index/OfficeManage/getDistance', ['method' => 'GET']], //获取两个经纬度距离 'getDistance' => ['index/OfficeManage/getDistance', ['method' => 'GET']], //获取两个经纬度距离
'getHouseAddress' => ['index/OfficeRoom/checkRepetition', ['method' => 'get']], //搜索楼号/栋/座+楼层+房号
]); ]);
Route::group('office_api', [ Route::group('office_api', [
......
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