public function devicesAttrs() { $pkg = new Pkg(); $pkg->multi(); $pkg->getDeviceBusinessList(); $pkg->getDeviceIdcList(); $rets = $pkg->exec(); $businessRet = array_shift($rets); $idcRet = array_shift($rets); // 控制 Curl 请求错误 $this->handleCurlError($pkg, 0); $this->handleCurlError($pkg, 1); $businessList = array_map(function ($row) { return $row['business']; }, $businessRet); $idcList = array_map(function ($row) { return $row['idc']; }, $idcRet); sort($businessList); sort($idcList); Flight::json(compact('businessList', 'idcList')); }