Commit 8e1b7ab6 authored by hujun's avatar hujun

楼盘搜索

parent e598f971
......@@ -11,6 +11,8 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\index\service\OfficeRoomService;
use app\index\service\OfficeService;
use app\model\OfficeGBuilding;
class OfficeRoom extends Basic
{
......@@ -101,4 +103,32 @@ class OfficeRoom extends Basic
return $this->response($result['status'],$result['msg'], $result['data']);
}
/**
* 搜索楼盘
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBuildingSearch()
{
$msg = '';
$data = [];
$code = 200;
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$building_service = new OfficeService();
$result = $building_service->BuildingSearch($pageNo, $pageSize, $this->params);
if ($result['status'] == 'fail') {
$code = 101;
$msg = $result['msg'];
} else {
$data = $result['data'];
}
return $this->response($code, $msg, $data);
}
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ namespace app\index\controller;
use app\api_broker\extend\Basic;
use app\index\service\OfficeRoomService;
use app\index\service\OfficeService;
class OfficeRoom extends Basic
{
......@@ -61,4 +62,33 @@ class OfficeRoom extends Basic
return $this->response($result['code'], $result['msg'], $result_data);
}
/**
* 搜索楼盘
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBuildingSearch()
{
$msg = '';
$data = [];
$code = 200;
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$building_service = new OfficeService();
$result = $building_service->BuildingSearch($pageNo, $pageSize, $this->params);
if ($result['status'] == 'fail') {
$code = 101;
$msg = $result['msg'];
} else {
$data = $result['data'];
}
return $this->response($code, $msg, $data);
}
}
\ No newline at end of file
......@@ -212,4 +212,36 @@ class OfficeService
return $data;
}
/**
* @param $page_size
* @param $page_no
* @param $params
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function BuildingSearch($page_size, $page_no, $params)
{
$result['status'] = 'fail';
$result['msg'] = '';
if (empty($params['title'])) {
$result['msg'] = '参数错误';
return $result;
}
if (empty($params['city'])) {
$result['msg'] = '参数错误';
return $result;
}
$field = 'id,title,address';
$where['title'] = ['LIKE', '%'.$params['title'].'%'];
$where['city'] = $params['city'];
$data = $this->m_office->getList($page_size, $page_no, '', $field, $where);
$result['data'] = $data;
$result['status'] = 'successful';
return $result;
}
}
\ No newline at end of file
......@@ -27,7 +27,7 @@ class OfficeBuildingRoomValidate extends Validate
'station_end' => 'require|between: 1,99999',
'area' => 'require|between: 1,99999',
'floor_tag' => 'require|in:1,2,3',
'enter_time' => 'require',
'enter_date' => 'require',
'payment_month' => 'require|between:1,12',
'deposit_month' => 'require|between:1,12',
'age_limit_start' => 'require|between:1,12',
......
......@@ -47,6 +47,11 @@ class OfficeGRoom extends BaseModel
$save_data['floor'] = (int)$data['floor'];
}
//楼盘id
if (isset($data['building_id'])) {
$save_data['building_id'] = (int)$data['building_id'];
}
//门牌号
if (isset($data['room_number'])) {
$save_data['room_number'] = $data['room_number'];
......@@ -103,8 +108,8 @@ class OfficeGRoom extends BaseModel
}
//入住时间
if (isset($data['enter_time'])) {
$save_data['enter_time'] = $data['enter_time'];
if (isset($data['enter_date'])) {
$save_data['enter_date'] = $data['enter_date'];
}
//付款规则(按月)-付款
......
......@@ -963,17 +963,17 @@ 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']],//楼盘字典新增和编辑
'getOfficeRoomInfo' => [ 'api_broker/OfficeRoom/getOfficeRoomInfo', [ 'method' => 'POST' ] ],//获取房源详情
'houseEdit' => ['api_broker/OfficeRoom/edit', ['method' => 'POST|GET']],//楼盘字典新增和编辑
'delHouseFile' => ['api_broker/OfficeRoom/delHouseFile', ['method' => 'POST']],//删除楼盘图片
'getBuildingSearch' => ['api_broker/OfficeRoom/getBuildingSearch', ['method' => 'GET']],//搜索楼盘
]);
Route::group('office_index', [
'houseAdd' => [ 'index/OfficeManage/add', [ 'method' => 'GET|POST' ] ],//楼盘字典新增
'houseEdit' => [ 'index/OfficeManage/edit', [ 'method' => 'GET|POST' ] ],//楼盘字典编辑
'delHouseFile' => [ 'index/OfficeManage/delHouseFile', [ 'method' => 'POST' ] ],//删除楼盘图片
'houseDictionaryAdd' => ['index/OfficeManage/add', ['method' => 'GET|POST']],//楼盘字典新增
'houseDictionaryEdit' => ['index/OfficeManage/edit', ['method' => 'GET|POST']],//楼盘字典编辑
'getBuildingSearch' => ['index/OfficeRoom/getBuildingSearch', ['method' => 'GET']],//搜索楼盘
]);
//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