Commit dd00f400 authored by hujun's avatar hujun

商圈列表优化

parent abb4e987
......@@ -86,7 +86,7 @@ class BusinessDistrict extends Basic
/**
* 获取商圈列表
*
* @return mixed
* @return \think\Response|\think\response\View
*/
public function getBusiness() {
......@@ -94,18 +94,40 @@ class BusinessDistrict extends Basic
$data['status'] = 200;
$data['msg'] = '';
$params = $this->request->param();
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$auth_group = New GBusinessDistrict();
$where = 'is_del = 0';
if ($params['name'] != NULL) {
$where .= ' and name like "' . $params['name'] . '%"';
$where['is_del'] = 0;
if ($this->params['name'] != NULL) {
$where['name'] = ['LIKE', '%'.$this->params['name'].'%'];
}
if (!empty($this->params['province'])) {
$where['province'] = $this->params['province'];
}
if (!empty($this->params['city'])) {
$where['city'] = $this->params['city'];
}
if (!empty($this->params['disc'])) {
$where['disc'] = $this->params['disc'];
}
$fields = 'id,name,province,city,disc,status,create_time';
$data['list'] = $auth_group->getList($pageNo, $pageSize, 'id desc', $fields, $where);
$data['total'] = $auth_group->getTotal($where);
try {
$auth_group = New GBusinessDistrict();
$data['list'] = $auth_group->getList($pageNo, $pageSize, 'id desc', $fields, $where);
$data['total'] = $auth_group->getTotal($where);
} catch (\Exception $e) {
$data['list'] = [];
$data['total'] = 0;
$data['status'] = 101;
$data['msg'] = $e->getMessage();
}
return $this->response(200, '', $data);
} else {
return view('business_district/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