/** * (non-PHPdoc) * @see \Api\Abs::_process() */ protected function _process($result, \Comm\Request\Single $request) { $result = json_decode($result); if (!empty($result->message)) { $request_info = $request->showInfo(); $code = isset($request_info['http_code']) ? $request_info['http_code'] : 0; $e = new \Exception\Api($result->message, $code); $e->http_code = $code; throw $e; } return $result; }
/** * 返回数据 * * @param \Comm\Request\Single $request * * @return \Comm\Request\Single|mixed */ protected function _returnRequest(\Comm\Request\Single $request) { if ($this->_multi_request) { return $request; } else { $result = $request->exec(); return $this->_process($result, $request); } }
/** * (non-PHPdoc) * @see \Api\Abs::_prepareRequest() */ protected function _prepareRequest(\Comm\Request\Single $request) { $request->setHeader(['Accept: application/json']); }