['d.is_distribution'], '%like%' => ['u.sn', 'u.nickname'] ]; } /** * @notes 搜索 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author Tab * @date 2021/9/14 11:18 */ public function lists(): array { $field = [ 'u.id', 'u.sn', 'u.nickname', 'u.mobile', 'u.avatar', 'u.create_time', 'u.user_money', 'u.user_delete', 'd.is_distribution' ]; $lists = User::alias('u') ->leftJoin('distribution d', 'd.user_id = u.id') ->field($field) ->where($this->searchWhere) ->where('user_delete', 0) ->limit($this->limitOffset, $this->limitLength) ->select() ->toArray(); return $lists; } /** * @notes 记录数 * @return int * @author Tab * @date 2021/9/14 11:19 */ public function count(): int { $count = User::alias('u') ->leftJoin('distribution d', 'd.user_id = u.id') ->where($this->searchWhere) ->where('user_delete', 0) ->count(); return $count; } }