Commit b9a83daa authored by zhuwei's avatar zhuwei

客户搜索

parent fcd49c1d
......@@ -147,24 +147,32 @@ class Broker extends Basic
*/
public function user_search()
{
$Two_days_ago = date("Y-m-d h:i:s",strtotime("-2 day"));
//dump($Two_days_ago);
$params = $this->params;
/*$params['phone_or_name'] ='22';
$params['pagenum'] ='1';*/
if (!isset($params['phone_or_name'])) {
$params['pagenum'] ='1';
$params['user_id'] ='10';*/
if (!isset($params['phone_or_name']) || !isset($params['user_id'])) {
return $this->response("300", "参数不全", [ 'remote_groupid' => '' ]);
}
$phone_or_name = trim($params['phone_or_name']);
$pagenum = isset($params['pagenum']) ? $params['pagenum'] : 1;
$pagesize = 15;
$user_id = $params['user_id'];
$user = new Users();
// 查询数据集
$user_res =$user ->where('user_nick|user_phone','like',"%$phone_or_name%")
->where('create_time','< time',$Two_days_ago)//小于两天前,即排除48小时内受保护的客户
->whereOr('agent_id',$user_id)
->limit($pagesize)
->page($pagenum)
->select();
$total =$user ->where('user_nick|user_phone','like',"%$phone_or_name%")
->where('create_time','< time',$Two_days_ago)
->whereOr('agent_id',$user_id)
->count();
$total = intval($total / $pagesize) + (($total % $pagesize == 0) ? 0 : 1);
......
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