['status'], ]; } /** * @notes 获取列表 * @return array */ public function lists(): array { $this->searchWhere[] = ['user_id', '=', $this->userId]; return SvDevice::field('id,device_code,status,device_model,sdk_version,create_time') ->where($this->searchWhere) ->order('id', 'desc') ->limit($this->limitOffset, $this->limitLength) ->select() ->each(function ($item) { // 请求在线状态 $account = SvAccount::where('device_code',$item->device_code)->field('id,type,account')->select()->toArray(); $item['account'] = $account; }) ->toArray(); } /** * @notes 获取数量 * @return int */ public function count(): int { $this->searchWhere[] = ['user_id', '=', $this->userId]; return SvDevice::where($this->searchWhere)->count(); } }