['ps.status'], '%like%' => ['ps.name'], '%like%' => ['a.account'], ]; } /** * @notes 获取列表 * @return array */ public function lists(): array { return SvPublishSettingAccount::alias('ps') ->field('ps.*, a.nickname, a.avatar') ->join('sv_account a', 'a.account = ps.account and a.device_code = ps.device_code and a.type = ps.account_type') ->where($this->searchWhere) ->when($this->request->get('start_time') && $this->request->get('end_time'), function ($query) { $query->whereBetween('ps.create_time', [strtotime($this->request->get('start_time')), strtotime($this->request->get('end_time'))]); }) ->order('ps.id', 'desc') ->limit($this->limitOffset, $this->limitLength) ->select() ->toArray(); } /** * @notes 获取数量 * @return int */ public function count(): int { return SvPublishSettingAccount::alias('ps')->field('id') ->join('sv_account a', 'a.account = ps.account and a.device_code = ps.device_code and a.type = ps.account_type') ->when($this->request->get('start_time') && $this->request->get('end_time'), function ($query) { $query->whereBetween('ps.create_time', [strtotime($this->request->get('start_time')), strtotime($this->request->get('end_time'))]); }) ->where($this->searchWhere) ->count(); } }