Commit 5f8c1215 authored by zfc's avatar zfc

客方搜索

parent 5c0b7e5b
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
namespace app\api_broker\controller; namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\index\controller\Agent;
use app\model\Agents;
use app\model\Users; use app\model\Users;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowPp;
...@@ -60,6 +62,34 @@ class Client extends Basic ...@@ -60,6 +62,34 @@ class Client extends Basic
return $this->response($this->code, $this->msg,$this->data); return $this->response($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 agentSearch(){
$table= new Agents;
$data['msg'] = '';
$params = $this->request->param();
$search=$params['search'];
$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($search)){
$where.=" and realname like '%$search%' or phone like '%$search%' ";
$data['search']=$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);
}
/**app 经纪人用户列表 /**app 经纪人用户列表
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
...@@ -98,11 +128,10 @@ class Client extends Basic ...@@ -98,11 +128,10 @@ class Client extends Basic
} }
// echo $where;exit; // echo $where;exit;
$order="id asc"; $order="id desc";
$data['list']=$table->getAgentUserTb($pageNo, $pageSize,$order,$field, $where); $data['list']=$table->getAgentUserTb($pageNo, $pageSize,$order,$field, $where);
$total=$table->getUserAgentTotal($where); $total=$table->getUserAgentTotal($where);
$total2 = intval($total / $pageSize); $data['total']= ceil($total / $pageSize);
$data['total']= $total2==0 ? 1 : $total2;
$data['page']=$pageNo; $data['page']=$pageNo;
return $this->response(200,'成功',$data); return $this->response(200,'成功',$data);
...@@ -148,8 +177,7 @@ class Client extends Basic ...@@ -148,8 +177,7 @@ class Client extends Basic
$order="id desc"; $order="id desc";
$data['list']=$table->getSearch($pageNo, $pageSize,$order,$field,$join, $where,$group); $data['list']=$table->getSearch($pageNo, $pageSize,$order,$field,$join, $where,$group);
$total=$table->getUserAgentTotal($where,$join); $total=$table->getUserAgentTotal($where,$join);
$total2 = intval($total / $pageSize); $data['total'] =ceil($total / $pageSize);
$data['total']= $total2==0 ? 1 : $total2;
$data['page']=$pageNo; $data['page']=$pageNo;
return $this->response(200,'成功',$data); return $this->response(200,'成功',$data);
} }
......
...@@ -9,14 +9,16 @@ class Agents extends Model ...@@ -9,14 +9,16 @@ class Agents extends Model
{ {
/** /**
* 查询经纪人 * 查询经纪人
* * @param int $pageNo
* @param type $pageNo * @param int $pageSize
* @param type $pageSize * @param string $order_
* @param type $order_ * @param $field
* @param type $field * @param $params
* @param type $params * @param string $house_id
* @param type $house_id 查询该街铺和商铺的经纪人评论信息 * @return false|\PDOStatement|string|\think\Collection
* @return type * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function getUser($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $house_id = '') { public function getUser($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $house_id = '') {
if ($house_id == '') { if ($house_id == '') {
...@@ -44,12 +46,14 @@ class Agents extends Model ...@@ -44,12 +46,14 @@ class Agents extends Model
return $data; return $data;
} }
/** /**
* 经纪人详情 * 经纪人详情
* * @param $id
* @param type $id * @return array|bool|false|\PDOStatement|string|Model
* @return boolean * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function agentsDetail($id) { public function agentsDetail($id) {
if ($id) { if ($id) {
...@@ -133,4 +137,35 @@ class Agents extends Model ...@@ -133,4 +137,35 @@ class Agents extends Model
return $data; return $data;
} }
/**
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param string $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function searchList($pageNo=1, $pageSize=15,$order_='id desc',$field, $where=''){
$r =$this->field($field)
->where($where)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
return $r;
}
/**
* @param $params
* @return int|string
*/
public function searchTotal($params)
{
return $this->where($params)->count();
}
} }
...@@ -208,7 +208,7 @@ Route::group('api', [ ...@@ -208,7 +208,7 @@ Route::group('api', [
'agentUserTb' => [ 'api_broker/Client/agentUserTb', [ 'method' => 'get' ] ],//客户列表 'agentUserTb' => [ 'api_broker/Client/agentUserTb', [ 'method' => 'get' ] ],//客户列表
'agentUserFollow' => [ 'api_broker/Client/agentUserFollow', [ 'method' => 'get' ] ],//客户列表 'agentUserFollow' => [ 'api_broker/Client/agentUserFollow', [ 'method' => 'get' ] ],//客户列表
'agentSearch' => [ 'api_broker/Client/agentSearch', [ 'method' => 'get' ] ],//经纪人搜索
]); ]);
Route::group('task',[ Route::group('task',[
......
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