Commit 2fe62253 authored by hujun's avatar hujun

删除楼盘

parent 8a4fbf95
......@@ -98,4 +98,60 @@ class OfficeManage extends Basic
return $this->response($code, $msg);
}
/**
* 楼盘列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBuildingList()
{
if (!$this->request->isAjax()) {
return view('office/index');
}
$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->params1, 1);
if ($result['status'] == 'fail') {
$code = 101;
$msg = $result['msg'];
} else {
$data = $result['data'];
}
return $this->response($code, $msg, $data);
}
/**
* 楼盘列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function delBuilding()
{
$msg = '';
$data = [];
$code = 200;
$building_service = new OfficeService();
$result = $building_service->delOfficeBuilding($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
......@@ -9,7 +9,7 @@
namespace app\index\controller;
use app\api_broker\extend\Basic;
use app\index\extend\Basic;
use app\index\service\OfficeRoomService;
use app\index\service\OfficeService;
......
......@@ -30,7 +30,7 @@ class OfficeService
}
/**
* 新增或编辑楼盘
* 新增或编辑楼盘字典
*
* @param array $data
* @param int $agent_id 上传人id
......@@ -103,7 +103,7 @@ class OfficeService
}
/**
* 楼盘详情
* 楼盘字典详情
*
* @param int $id
* @param int $app
......@@ -167,7 +167,7 @@ class OfficeService
}
/**
* 删除图片
* 删除楼盘字典图片
*
* @param int $id
* @param $house_id
......@@ -209,15 +209,18 @@ class OfficeService
}
/**
* 楼盘字典查询
*
* @param $page_size
* @param $page_no
* @param $params
* @param $is_total
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function BuildingSearch($page_size, $page_no, $params)
public function BuildingSearch($page_size, $page_no, $params, $is_total = 0)
{
$result['status'] = 'fail';
$result['msg'] = '';
......@@ -231,12 +234,68 @@ class OfficeService
return $result;
}
$field = 'id,title,address';
$where['title'] = ['LIKE', '%'.$params['title'].'%'];
if (isset($params['title'])) {
$where['title'] = ['LIKE', '%'.$params['title'].'%'];
}
if (isset($params['disc'])) {
$where['disc'] = $params['disc'];
}
if (isset($params['`business_district_id`'])) {
$where['business_district_id'] = $params['business_district_id'];
}
if (isset($params['type'])) {
$where['type'] = $params['type'];
}
$field = 'id,title,address,type';
$where['city'] = $params['city'];
$data = $this->m_office->getList($page_size, $page_no, '', $field, $where);
if ($is_total) {
$data = $this->m_office->getTotal($where);
}
$result['data'] = $data;
$result['status'] = 'successful';
return $result;
}
/**
* 删除楼盘字典
*
* @param $id
* @return false|int
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* User HuJun
* Date 19-6-2 上午11:16
*/
public function delOfficeBuilding($id)
{
$result['status'] = 'fail';
$result['msg'] = '';
if (empty($id)) {
$result['msg'] = '参数错误';
return $result;
}
$id = $this->m_office->getFindData('id', ['id'=>$id]);
if (empty($id['id'])) {
$data['msg'] = '没有该记录';
} else {
$result = $this->m_office->editData(['is_del' => 1], $id['id']);
if ($result) {
$data['status'] = 200;
$data['msg'] = '删除成功';
} else {
$data['msg'] = '删除失败';
}
}
return $data;
}
}
\ No newline at end of file
{layout name="global/frame_two_tpl" /}
楼盘列表
\ No newline at end of file
......@@ -979,6 +979,8 @@ Route::group('office_index', [
'delBuildingFile' => ['index/OfficeBuilding/delBuildingFile', ['method' => 'POST']],//删除楼盘图片
'getBuildingSearch' => ['index/OfficeRoom/getBuildingSearch', ['method' => 'GET']],//搜索楼盘
'getBuildingDetail' => ['index/OfficeRoom/getBuildingDetail', ['method' => 'GET']],//楼盘详情
'getBuildingList' => ['index/OfficeManage/getBuildingList', ['method' => 'GET']],//楼盘列表
'delBuilding' => ['index/OfficeManage/delBuilding', ['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