params['user_info']) && $this->params['user_info'] != '') { $where[] = ['nickname|mobile|sn|account','like','%'.$this->params['user_info'].'%']; } if (isset($this->params['start_time']) && $this->params['start_time'] != '') { $where[] = ['create_time','>=',strtotime($this->params['start_time'])]; } if (isset($this->params['end_time']) && $this->params['end_time'] != '') { $where[] = ['create_time','<=',strtotime($this->params['end_time'])]; } if (isset($this->params['register_source']) && $this->params['register_source'] != '') { $where[] = ['channel','=',$this->params['register_source']]; } return $where; } /** * @notes 获取用户列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author ljj * @date 2022/2/7 6:51 下午 */ public function lists(): array { $lists = (new User())->field('id,sn,nickname,avatar,mobile,sex,create_time,channel as register_source,account') ->order('id', 'desc') ->where($this->where()) ->append(['sex_desc','source_desc']) ->limit($this->limitOffset, $this->limitLength) ->select() ->toArray(); return $lists; } /** * @notes 获取用户数量 * @return int * @author ljj * @date 2022/2/7 6:52 下午 */ public function count(): int { return (new User())->where($this->where())->count(); } }