Commit c5edd9f3 authored by hujun's avatar hujun

报备搜索办公楼

parent 3547b3d4
...@@ -13,6 +13,7 @@ use app\api_broker\extend\Basic; ...@@ -13,6 +13,7 @@ use app\api_broker\extend\Basic;
use app\index\service\OfficeRoomService; use app\index\service\OfficeRoomService;
use app\index\service\OfficeService; use app\index\service\OfficeService;
use app\model\OfficeGBuilding; use app\model\OfficeGBuilding;
use app\model\OfficeGRoom;
class OfficeRoom extends Basic class OfficeRoom extends Basic
{ {
...@@ -160,4 +161,48 @@ class OfficeRoom extends Basic ...@@ -160,4 +161,48 @@ class OfficeRoom extends Basic
return $this->result($this->code, $this->msg, $this->data); return $this->result($this->code, $this->msg, $this->data);
} }
/**
* 报备搜索商铺
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getRoomListByReport()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
$params = array(
"keyword" => "1", //1,2 external_title ,3,4internal_title
"pageNo" => 1,
"pageSize" => 15
);
$conditions = [];
$field = "a.id,b.title,b.address";
if(empty($params["city"])){
$conditions["b.city"] = trim($this->city);
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
if (isset($params['keyword']) && !empty($params['keyword']) ) {
$conditions['a.id|b.title'] = array("like","%" . trim($params['keyword']) . "%");
}
$order_ = "b.status asc,b.id desc";
$conditions['b.status'] = array('eq', 1); //只显示上架
$m_office_build = new OfficeGRoom();
$result = $m_office_build->getRoomList($pageNo, $pageSize, $order_, $field, $conditions, []);
if (empty($result)) {
return $this->response("200", "此条件没有找到数据");
}
return $this->response("200", 'request success', $result);
}
} }
\ No newline at end of file
...@@ -335,4 +335,37 @@ class OfficeGRoom extends BaseModel ...@@ -335,4 +335,37 @@ class OfficeGRoom extends BaseModel
->select(); ->select();
return $result; return $result;
} }
/**
* 查询商铺列表
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param $params
* @param $spTagsArr
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
function getRoomList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $spTagsArr)
{
$result = $this->db_
->field($field)
->alias('a')
->join('office_g_building b', 'a.building_id = b.id', 'left')
->where($params)
->where(function ($query) use ($spTagsArr) {
$query->whereOr($spTagsArr);
})
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
//echo Db::table($this->table)->getLastSql();
return $result;
}
} }
...@@ -982,6 +982,7 @@ Route::group('office', [ ...@@ -982,6 +982,7 @@ Route::group('office', [
'reportList' => ['api_broker/OfficeReport/reportList', ['method' => 'get']], 'reportList' => ['api_broker/OfficeReport/reportList', ['method' => 'get']],
'getCheckType' => ['api_broker/OfficeReport/getCheckType', ['method' => 'get|post']], 'getCheckType' => ['api_broker/OfficeReport/getCheckType', ['method' => 'get|post']],
'reportListForPc' => ['api_broker/OfficeReport/reportListForPc', ['method' => 'get']], 'reportListForPc' => ['api_broker/OfficeReport/reportListForPc', ['method' => 'get']],
'getRoomListByReport' => ['api_broker/OfficeRoom/getRoomListByReport', ['method' => 'get|post']],
]); ]);
Route::group('office_index', [ Route::group('office_index', [
......
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