예제 #1
0
 public function returnResult($rst)
 {
     $api_response_xml = $rst;
     $rst = Helpers::xmlToArray($rst);
     if (!empty($rst['return_code'])) {
         if ($rst['return_code'] == 'FAIL') {
             throw new \Exception($rst['return_msg']);
         } else {
             if ($rst['result_code'] == 'FAIL') {
                 throw new \Exception($rst['err_code'] . ":" . $rst['err_code_des']);
             } else {
                 $rst['api_response_xml'] = $api_response_xml;
                 return $rst;
             }
         }
     } else {
         throw new \Exception("网络请求失败");
     }
 }
예제 #2
0
파일: WxPay.php 프로젝트: raymonder/weixin
 private function returnResult($rst)
 {
     $rst = Helpers::xmlToArray($rst);
     if (!empty($rst['return_code'])) {
         if ($rst['return_code'] == 'FAIL') {
             throw new \Exception($rst['return_msg']);
         } else {
             if ($rst['result_code'] == 'FAIL') {
                 throw new \Exception($rst['err_code'] . ":" . $rst['err_code_des']);
             } else {
                 return $rst;
             }
         }
     } else {
         throw new \Exception("网络请求失败");
     }
 }