Commit bac92942 authored by hujun's avatar hujun

客房经纪人搜索更换新表

parent af04a6a4
...@@ -82,7 +82,9 @@ class Client extends Basic ...@@ -82,7 +82,9 @@ class Client extends Basic
} }
/**经纪人搜索 /**
* 经纪人搜索
*
* @return \think\Response * @return \think\Response
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
...@@ -90,23 +92,35 @@ class Client extends Basic ...@@ -90,23 +92,35 @@ class Client extends Basic
*/ */
public function agentSearch(){ public function agentSearch(){
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$table= new Agents;
$agent = new AAgents();
$data['msg'] = ''; $data['msg'] = '';
$params = $this->request->param(); $params = $this->request->param();
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$field = ['id','realname','phone'];
$where = 'level in(2,5) '; $where = 'status <> 2';
if(!empty($params['search'])){ if ($this->params['search']) {
$where .=" and realname like '%{$params['search']}%' or phone like '%{$params['search']}%' "; $where .= ' AND concat(phone,name) like "%'.$this->params['search'].'%"';
$data['search'] = $params['search'];
} }
$order="id desc";
$data['list']=$table->searchList($pageNo, $pageSize,$order,$field, $where); if ($this->params['level']) {
$total=$table->searchTotal($where); $where .= ' AND level in ('.$this->params['level'].')';
$data['total']= ceil($total / $pageSize); }
$data['page']=$pageNo;
return $this->response(200,'成功',$data); if ($where) {
$field = 'id,name as realname,phone';
$data['list'] = $agent->getList($pageNo, $pageSize, 'id DESC', $field, '',$where);
$total = $agent->getTotal($where);
$data['total'] = ceil($total / $pageSize);
$data['page'] = $pageNo;
$msg = '成功';
} else {
$msg = '没有经纪人信息';
}
$data['page'] = $pageNo;
return $this->response(200, $msg, $data);
} }
/**app 经纪人用户列表 /**app 经纪人用户列表
......
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