public static function ResponsetoApp($retcode, $msg_body) { global $req_token; // 授权码 global $au_token; // 动态码 global $req_version; // 版本号 global $req_bkenv; // 银联环境 global $req_time; global $api_name; global $api_name_func; global $reqcontext; global $authorid; global $authortruename; global $g_sdcrid; $arr_retmsg = array('0' => '成功', '500' => '执行代码错误', '600' => '客户端调用错误', '700' => '数据库出错', '900' => '引用延迟', '800' => '银行卡交易代码请求错误,请填写正确的银行卡信息', '400' => '商户权限不足', '300' => '停留时间太长,请重新登录!', '404' => '请求功能不存在', '505' => '用户信息已被异地篡改,请重新登录', '200' => '自定义错误', '100' => '商户权限不足'); if ($retcode != '200' && $retcode != '0' && $retcode != '300') { $retmsg = $arr_retmsg[$retcode]; } else { if ($retcode != '700' or $retcode != '800') { $retmsg = $msg_body['msgbody']['message']; } } if ($g_sdcrid >= '100') { $req_bkenv = '01'; //测试环境 } else { $req_bkenv = '00'; //正式环境 } $msg_header = array('msgheader' => array('au_token' => $au_token, 'req_token' => $req_token, 'req_bkenv' => $req_bkenv, 'retinfo' => array('rettype' => $retcode, 'retcode' => $retcode, 'retmsg' => $retmsg))); $Responsecontext['operation_response'] = array_merge($msg_header, $msg_body); $rqvalue = xml_encode($Responsecontext, 'utf-8'); //$returnval =""; $reqcry = TfbAuthRequest::getReqDatatype($reqcontext); //请求的数据流 $TfbAuthRequest = new TfbAuthRequest(); if ($reqcry == 'E') { $returnval = $TfbAuthRequest->desEncryptStr($rqvalue); } else { $returnval = $rqvalue; } $authorid = $authorid + 0; $file = "../../" . CONST_LOGDIR . "/" . date('md') . "-" . $authortruename . "log" . ".txt"; $filehandle = fopen($file, "a"); fwrite($filehandle, "\r\n======响应内容:\r\n" . $rqvalue . "\r\n\r\n" . $returnval . "\r\n\r\n<!--------------结束------------>\r\n\r\n\r\n"); fclose($filehandle); return $returnval; }
<?php header('Content-Type: application/x-www-form-urlencoded'); header('Content-Type:text/html;charset=utf-8'); require "../include/common.inc.php"; require "../class/tfbrequest.class.php"; require "../class/tfbslotcard.class.php"; require "../class/tfbxmlResponse.class.php"; include_once "../third_api/kuaidi.class.php"; include_once "../third_api/mssale.class.php"; $arr_limitauthorid = array('82', '102'); error_reporting(E_ERROR); $reqcontext = file_get_contents("php://input"); $TfbAuthRequest = new TfbAuthRequest(); $Publiccls = new PublicClass(); //初始化类实例 set_error_handler('my_error_handler'); $reqxmlcontext = $TfbAuthRequest->getReqContext($reqcontext); //解密并获得请求数据 $arr_xml = $Publiccls->xml_to_array($reqxmlcontext); $authorid = $arr_xml['operation_request']['msgheader']['channelinfo']['authorid']; $arr_authorinfo = AuToken::getauthorusername($authorid); $authortruename = $arr_authorinfo['username']; $file = "../../" . CONST_LOGDIR . "/" . date('md') . "-" . $authortruename . "log" . ".txt"; $filehandle = fopen($file, "a"); $now = date('Y-m-d H:i:s'); fwrite($filehandle, $now . "\r\n======请求内容:\r\n" . $reqcontext . "\r\n\r\n" . $reqxmlcontext); fclose($filehandle); $apiAutoken = $TfbAuthRequest->apiAutoken($reqxmlcontext); //授权码等信息验证 if ($apiAutoken && $api_name && $api_name_func) {
$checkenc = "checked"; $checkdec = ""; switch ($action) { case "jisuan": if ($type == 'enc') { $checkenc = "checked"; $checkdec = ""; $TfbAuthRequest = new TfbAuthRequest(); $resultcontent = $TfbAuthRequest->desEncryptStr($TestCode); //echo var_dump($TestCode); } else { if ($type == 'dec') { //echo "dec"; $checkenc = ""; $checkdec = "checked"; $TfbAuthRequest = new TfbAuthRequest(); $apiname = $TfbAuthRequest->DesDecryptStr($resultcontent); } } $action = ""; break; } $query = "select * from web_test_interface where fd_interface_active = 1 order by fd_interface_sortorder,fd_interface_no asc"; $db->query($query); if ($db->nf()) { while ($db->next_record()) { $arr_dept_easyname[] = $db->f(fd_interface_no) . g2u($db->f(fd_interface_name)); $arr_dept_id[] = $db->f(fd_interface_id); } } // echo $interface_id;