示例#1
0
文件: Crew.php 项目: ratibus/pflow
 /**
  * @throws RuntimeException
  * @param int $projectId
  * @param string $branch
  * @param string $baseBranch
  * @param string $lastCommit
  * @return string
  */
 public function reviewRequest($projectId, $branch, $baseBranch, $lastCommit)
 {
     $client = new Http_Client();
     $params = array('branch' => $branch, 'base_branch' => $baseBranch, 'commit' => $lastCommit);
     $response = $client->post(sprintf('%s/api.php/projects/%s/reviews', $this->getUrl(), $projectId), $params);
     $json = (array) json_decode($response->getContent());
     if (!in_array($response->getCode(), array(200, 201)) || is_null($json)) {
         if (isset($json['message'])) {
             throw new RuntimeException(sprintf('Crew->reviewRequest : %s', $json['message']));
         }
         throw new RuntimeException(sprintf("Crew->reviewRequest : invalid result data.\n\n%s", $response->getContent()));
     }
     return $json['message'];
 }
示例#2
0
文件: pay.php 项目: yiuked/tmcart
         if (isset($parts['port'])) {
             $port = intval($parts['port']);
         } else {
             if ($scheme == 'https') {
                 $port = 443;
             } else {
                 $port = 80;
             }
         }
         $httpClient = new Http_Client($host);
         $httpClient->setDebug(PAY_DEBUG);
         $httpClient->setPersistReferers(false);
         $httpClient->referer = $referer;
         $httpClient->setUserAgent($userAgent);
         $httpClient->timeout = HTTP_TIMEOUT;
         $flag = $httpClient->post($path, $data);
         $status = $httpClient->getStatus();
         if ($flag === true) {
             $result = $httpClient->getContent();
         } else {
             $error = $httpClient->getError();
         }
     } else {
         Paylog::msg($cart->id, "300", "尝试curl和fsockopen提交定单到速汇通,均失败!");
         die(json_encode(array("isError" => "YES", "msg" => "300")));
     }
 }
 if ($status == 200 && $result) {
     parse_str($result, $rData);
     $systemResponse = new System_Response();
     Paylog::msg($cart->id, $rData['Succeed'], $systemResponse->getMsg($rData['Succeed']));