Commit bac92942 authored by hujun's avatar hujun

客房经纪人搜索更换新表

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