Ejemplo n.º 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("网络请求失败");
     }
 }
Ejemplo n.º 2
0
 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("网络请求失败");
     }
 }