Пример #1
0
 /**
  * @param array $params
  * @return Bll_Service_Client_HttpResponse
  * @throws Bll_Service_Exception
  */
 public function request($params = array())
 {
     // 准备参数
     if (empty($params)) {
         $params = $this->getParams();
     }
     $params = $this->prepareParams($params);
     // 验证参数
     $validator = new Util_Validator($params, $this->rules);
     if ($validator->fails()) {
         throw new Bll_Service_Exception('参数不合法:' . print_r($validator->errors(), true));
     }
     // 实例化客户端
     $httpClient = new Bll_Service_Client_Http($this->getOptions());
     // TODO request log
     // 发起请求
     $response = $httpClient->request($params);
     if ($response->isSucceeded()) {
         // TODO success log
     } else {
         // TODO error log
     }
     return $response;
 }