本文整理匯總了PHP中XML_unserialize函數的典型用法代碼示例。如果您正苦於以下問題:PHP XML_unserialize函數的具體用法?PHP XML_unserialize怎麽用?PHP XML_unserialize使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了XML_unserialize函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: wsnotify
function wsnotify($resultStr, $class_act, $cert_md5)
{
$pMerCode = $resultStr["pMerCode"];
$pErrCode = $resultStr["pErrCode"];
$pErrMsg = $resultStr["pErrMsg"];
$p3DesXmlPara = $resultStr["p3DesXmlPara"];
$pSign = $resultStr["pSign"];
$signPlainText = $pMerCode . $pErrCode . $pErrMsg . $p3DesXmlPara . $cert_md5;
$localSign = md5($signPlainText);
if ($localSign == $pSign) {
//file_put_contents(PATH_LOG_FILE,PATH."--".date('YmdHis')." 驗簽通過"."\r\n",FILE_APPEND);
$Crypt3Des = new Crypt3Des();
//new 3des class
$str3XmlParaInfo = $Crypt3Des->DESDecrypt($p3DesXmlPara);
//3des解密
if (empty($str3XmlParaInfo)) {
//file_put_contents(PATH_LOG_FILE,PATH."--".date('YmdHis')." 3DES解密失敗"."\r\n",FILE_APPEND);
return;
} else {
require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
$str3ParaInfo = @XML_unserialize($str3XmlParaInfo);
$str3Req = $str3ParaInfo['pReq'];
if ($class_act == 'GuaranteeUnfreeze') {
require_once APP_ROOT_PATH . 'system/collocation/ips/GuaranteeUnfreeze.php';
GuaranteeUnfreezeCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT);
}
if ($class_act == 'Transfer') {
require_once APP_ROOT_PATH . 'system/collocation/ips/Transfer.php';
TransferCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT);
}
}
}
}
示例2: __cddata
private function __cddata()
{
if (post('receive_address'))
{
include_once dirname(__FILE__).'/alipay.function.php';
$pdata = XML_unserialize(post('receive_address'));
$this->adata = $pdata['receiveAddress'];
}
}
示例3: QueryForAccBalance
function QueryForAccBalance($user_id, $platformNo, $post_url)
{
/* 請求參數 */
$req = "<request platformNo=\"{$platformNo}\"><platformUserNo>{$user_id}</platformUserNo></request>";
/* 簽名數據 */
$sign = "xxxx";
/* 調用賬戶查詢服務 */
$service = "ACCOUNT_INFO";
$ch = curl_init($post_url . "/bhaexter/bhaController");
curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_POSTFIELDS => 'service=' . $service . '&req=' . rawurlencode($req) . "&sign=" . rawurlencode($sign)));
$resultStr = curl_exec($ch);
//print($result);
if (empty($resultStr)) {
$result = array();
$result['pErrCode'] = 9999;
$result['pErrMsg'] = '返回出錯';
$result['pIpsAcctNo'] = '';
$result['pBalance'] = 0;
$result['pLock'] = 0;
$result['pNeedstl'] = 0;
} else {
require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
$str3ParaInfo = @XML_unserialize($resultStr);
//print_r($str3ParaInfo);exit;
$str3Req = $str3ParaInfo['response'];
$result = array();
if ($str3Req["code"] == 1) {
$result['pErrCode'] = "0000";
} else {
$result['pErrCode'] = $str3Req["code"];
}
$result['pErrMsg'] = $str3Req["description"];
$result['pIpsAcctNo'] = $user_id;
$result['pBalance'] = $str3Req["balance"] - $str3Req["freezeAmount"];
$result['pLock'] = $str3Req["freezeAmount"];
$result['pNeedstl'] = 0;
// $str3Req["availableAmount"];
}
return $result;
/*
* <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response platformNo="10040011137">
<code>1</code>
<description>操作成功</description>
<memberType>PERSONAL</memberType>
<activeStatus>ACTIVATED</activeStatus>
<balance>9980.98</balance>
<availableAmount>9980.98</availableAmount>
<freezeAmount>0.00</freezeAmount>
<cardNo>********5512</cardNo>
<cardStatus>VERIFIED</cardStatus>
<bank>CCB</bank>
<autoTender>false</autoTender>
</response>
*/
}
示例4: DoBids
/**
* 標的登記 及 流標
* @param int $deal_id
* @param int $pOperationType 標的操作類型,1:新增,2:結束 “新增”代表新增標的,“結束”代表標的正常還清、丌 需要再還款戒者標的流標等情況。標的“結束”後,投資 人投標凍結金額、擔保方保證金、借款人保證金均自勱解 凍
* @param int $status; 0:新增; 2:流標結束
* @param string $status_msg 主要是status_msg=2時記錄的,流標原因
* @param unknown_type $platformNo
* @param unknown_type $post_url
* @return string
*/
function DoBids($deal_id, $pOperationType, $status, $status_msg, $platformNo, $post_url)
{
$pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=yeepay&class_act=DoBids";
//web方式返回
$pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=yeepay&class_act=DoBids";
//s2s方式返回
//$requestNo = $GLOBALS['db']->getOne("select * from ".DB_PREFIX."yeepay_cp_transaction where is_callback = 1 and code = 1 and tenderOrderNo = '".$deal_id."'");
$t_arr = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "yeepay_cp_transaction where is_callback = 1 and tenderOrderNo = " . $deal_id . " and bizType = 'TENDER'");
$deal = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $deal_id);
$err_count = 0;
foreach ($t_arr as $k => $v) {
$data = array();
$data['requestNo'] = $v["requestNo"];
//請求流水號
$data['platformNo'] = $platformNo;
// 商戶編號
$data['mode'] = "CANCEL";
/* 請求參數 */
$req = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" . "<request platformNo=\"" . $platformNo . "\">" . "<requestNo>" . $data['requestNo'] . "</requestNo>" . "<mode>" . $data['mode'] . "</mode>" . "<notifyUrl><![CDATA[" . $pS2SUrl . "]]></notifyUrl>" . "</request>";
/* 簽名數據 */
$sign = "xxxx";
$yeepay_log = array();
$yeepay_log['code'] = 'COMPLETE_TRANSACTION';
$yeepay_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s');
$yeepay_log['strxml'] = $req;
$GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log);
//$id = $GLOBALS['db']->insert_id();
/* 調用賬戶查詢服務 */
$service = "COMPLETE_TRANSACTION";
$ch = curl_init($post_url . "/bhaexter/bhaController");
curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_POSTFIELDS => 'service=' . $service . '&req=' . rawurlencode($req) . "&sign=" . rawurlencode($sign)));
$resultStr = curl_exec($ch);
if (empty($resultStr)) {
$err_count++;
} else {
require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
$str3ParaInfo = @XML_unserialize($resultStr);
//print_r($str3ParaInfo);exit;
$str3Req = $str3ParaInfo['response'];
$result['pErrCode'] = $str3Req["code"];
$result['pErrMsg'] = $str3Req["description"];
//$result['pIpsAcctNo'] = $user_id;
if ($str3Req["code"] == 1) {
$requestNo = $str3Req['requestNo'];
$t_data = array();
$t_data["is_complete_transaction"] = 1;
$GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_cp_transaction", $t_data, 'UPDATE', " requestNo = '" . $requestNo . "'");
return array("info" => '操作成功');
}
}
}
//showIpsInfo('同步成功',"");
}
示例5: query_timestamp
/**
* 用於防釣魚,調用接口query_timestamp來獲取時間戳的處理函數
* 注意:若要使用遠程HTTP獲取數據,必須開通SSL服務,該服務請找到php.ini配置文件設置開啟,建議與您的網絡管理員聯係解決。
* return 時間戳字符串
*/
function query_timestamp()
{
$url = $this->alipay_gateway_new . "service=query_timestamp&partner=" . trim($this->aliapy_config['partner']);
$encrypt_key = "";
//獲取遠程數據
$xml_data = getHttpResponse($url);
//解析XML數據
$para_data = @XML_unserialize($xml_data);
//獲取時間戳
$encrypt_key = $para_data['alipay']['response']['timestamp']['encrypt_key'];
return $encrypt_key;
}
示例6: sendPostInfo
/**
* 構造模擬遠程HTTP的POST請求,獲取支付寶的返回XML處理結果
* @param $para_temp 請求參數數組
* @param $gateway 網關地址
* @param $aliapy_config 基本配置信息數組
* @return 支付寶返回XML處理結果
*/
function sendPostInfo($para_temp, $gateway, $aliapy_config)
{
$xml_str = '';
//待請求參數數組字符串
$request_data = $this->buildRequestParaToString($para_temp, $aliapy_config);
//請求的url完整鏈接
$url = $gateway . $request_data;
//遠程獲取數據
$xml_data = getHttpResponse($url, trim(strtolower($aliapy_config['input_charset'])));
//解析XML
$para_data = @XML_unserialize($xml_data);
return $para_data;
}
示例7: getPayPalEmailAddress
/**
* 獲取訂單當前收款的郵箱
* @param int $itemid
* @return array
* @author lzx
*/
public function getPayPalEmailAddress($itemid)
{
$requestXmlBody = ' <?xml version="1.0" encoding="utf-8"?>
<' . $this->verb . 'Request xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>' . $this->token . '</eBayAuthToken>
</RequesterCredentials>
<OutputSelector>Item.PayPalEmailAddress</OutputSelector>
<ItemID>' . $itemid . '</ItemID>
<WarningLevel>High</WarningLevel>
</' . $this->verb . 'Request>';
return XML_unserialize($this->sendHttpRequest($requestXmlBody));
}
示例8: fetchMessageBody
public function fetchMessageBody($messageid, $account)
{
/*----- 加載token文件 -----*/
$tokenfile = WEB_PATH . 'lib/ebaylibrary/keys/keys_' . $account . '.php';
if (!file_exists($tokenfile)) {
//授權文件不存在
self::$errCode = 10050;
self::$errMsg = '賬號授權文件不存在';
return FALSE;
}
include_once '' . $tokenfile;
/*----- 導出為全局變量 ugly code -----*/
$GLOBALS['siteID'] = $siteID;
$GLOBALS['production'] = $production;
$GLOBALS['compatabilityLevel'] = $compatabilityLevel;
$GLOBALS['devID'] = $devID;
$GLOBALS['appID'] = $appID;
$GLOBALS['certID'] = $certID;
$GLOBALS['serverUrl'] = $serverUrl;
$GLOBALS['userToken'] = $userToken;
/*----- 導出為全局變量 -----*/
/*----- 加載token文件 -----*/
$getmsgobj = new GetMemberMessagesAPI($account);
$responseXml = $getmsgobj->requestMessagesID($messageid);
//var_dump($responseXml);exit;
if (stristr($responseXml, 'HTTP 404') || $responseXml == '') {
self::$errCode = 10051;
self::$errMsg = '獲取失敗!';
return FALSE;
}
$responseDoc = new DomDocument();
$responseDoc->loadXML($responseXml);
$data = XML_unserialize($responseXml);
//print_r($data);exit;
$Content = $data['GetMyMessagesResponse']['Messages']['Message']['Text'];
if (empty($Content)) {
self::$errCode = 10051;
self::$errMsg = '獲取失敗!';
return FALSE;
}
$date = date('Y-m-d', time());
$filepath = MSGBODYSAVEPATH . $account . '/' . $date . '/' . $messageid . '.html';
if (write_a_file(MSGREALPREFIX . $filepath, $Content) === false) {
self::$errCode = 10052;
self::$errMsg = 'message文件保存失敗!';
return FALSE;
}
return $filepath;
}
示例9: SincerityGoldUnfreeze
function SincerityGoldUnfreeze($user_id, $platformNo, $freezeRequestNo, $deal_id, $post_url, $sys = 'pc')
{
//$pWebUrl= SITE_DOMAIN.APP_ROOT."/index.php?ctl=collocation&act=response&class_name=Yeepay&class_act=SincerityGoldUnfreeze&from=".$_REQUEST['from'];//web方式返回
//$pS2SUrl= SITE_DOMAIN.APP_ROOT."/index.php?ctl=collocation&act=notify&class_name=Yeepay&class_act=SincerityGoldUnfreeze&from=".$_REQUEST['from'];//s2s方式返回
$yeepay_log = array();
$yeepay_log['code'] = 'UNFREEZE';
$yeepay_log['create_date'] = to_date(NOW_TIME, 'Y-m-d H:i:s');
$GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log);
$requestNo = $GLOBALS['db']->insert_id();
$data = array();
$data['platformNo'] = $platformNo;
// 商戶編號
$data['freezeRequestNo'] = $freezeRequestNo;
$data['expired'] = NOW_TIME;
//到期自勱解凍時間
// $strxml = SincerityGoldUnfreezeXml($data,$pWebUrl,$pS2SUrl);
/* 請求參數 */
$req = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" . "<request platformNo='" . $data['platformNo'] . "'>" . "<freezeRequestNo>" . $data['freezeRequestNo'] . "</freezeRequestNo>" . "</request>";
/* 簽名數據 */
$sign = cfca($req);
/* 調用賬戶查詢服務 */
$service = "UNFREEZE";
$ch = curl_init($post_url . "/bhaexter/bhaController");
curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_POSTFIELDS => 'service=' . $service . '&req=' . rawurlencode($req) . "&sign=" . rawurlencode($sign)));
$resultStr = curl_exec($ch);
if (empty($resultStr)) {
//$err_count ++ ;
} else {
require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
$str3ParaInfo = @XML_unserialize($resultStr);
$str3Req = $str3ParaInfo['response'];
$result['pErrCode'] = $str3Req["code"];
$result['pErrMsg'] = $str3Req["description"];
if ($str3Req["code"] == 1) {
//操作成功
$where = " platformUserNo=" . $user_id . " and deal_id =" . $deal_id . " and requestNo=" . $freezeRequestNo;
$data['status'] = 2;
$data['create_time'] = NOW_TIME;
if (isset($str3Req['description'])) {
$data['description'] = $str3Req["description"];
}
$GLOBALS['db']->autoExecute(DB_PREFIX . "money_freeze", $data, 'UPDATE', $where);
showIpsInfo('誠意金解凍成功', get_domain() . APP_ROOT . '/m.php?m=UserFreeze&a=index&');
}
}
}
示例10: load_theme
function load_theme($url, $skip_file = false)
{
$this->error(false);
ob_start();
$xml = file_get_contents($url);
//, false, null, 0, 4*1024); // 5 paramater format only works in PHP5
$err = ob_get_contents();
if (!empty($err)) {
// cleanup the error a little bit so it's a little easier to tell what happened
$err = str_replace(' [function.file-get-contents]', '', strip_tags($err));
}
ob_end_clean();
$this->headers = $this->parse_headers($http_response_header);
$this->xml = array();
$data = array();
if ($xml !== false) {
// make sure the content-type returned is something reasonable (and not an image, etc).
if ($this->is_xml()) {
$data = XML_unserialize($xml);
if ($data and is_array($data['theme'])) {
$xml2 = simple_interpolate($xml, $data['theme'], true);
if ($xml2 != $xml) {
// unserialize the data once more since it had $vars in the XML
$data = XML_unserialize($xml2);
}
$this->xml = $data['theme'];
array_walk($this->xml, array(&$this, '_fix_xml_attrib'));
} else {
$this->error("Invalid theme XML format loaded from {$url}", PSTHEME_ERR_XML);
}
} else {
$this->error("Invalid content-type returned for XML (" . $this->headers['content-type'] . ")", PSTHEME_ERR_CONTENT);
}
} else {
$this->error($err, PSTHEME_ERR_NOTFOUND);
}
$ok = false;
if (!$this->error() and $this->xml) {
$ok = $this->validate_theme($skip_file);
if ($ok and file_exists(catfile($this->template_dir, $this->xml['name']))) {
$this->xml['theme_exists'] = true;
}
}
return $ok;
}
示例11: getSellerTransactions
/**
* 從交易信息獲取發貨地址
* @param string $orderid
* @return array
* @author lzx
*/
public function getSellerTransactions($orderid)
{
$requestXmlBody = ' <?xml version="1.0" encoding="utf-8"?>
<' . $this->verb . 'Request xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>' . $this->token . '</eBayAuthToken>
</RequesterCredentials>
<DetailLevel>ReturnAll</DetailLevel>
<OutputSelector>OrderArray.Order.TransactionArray.Transaction.Buyer.BuyerInfo.ShippingAddress</OutputSelector>
<IncludeFinalValueFee>true</IncludeFinalValueFee>
<OrderRole>Seller</OrderRole>
<OrderStatus>Completed</OrderStatus>
<OrderIDArray>
<OrderID>' . $orderid . '</OrderID>
</OrderIDArray>
</' . $this->verb . 'Request>';
return XML_unserialize($this->sendHttpRequest($requestXmlBody));
}
示例12: getOrderLists
/**
* 獲取訂單詳情
* @param array $order_ids
* @return array
* @author lzx
*/
public function getOrderLists($order_ids)
{
$order_ids = array_filter($order_ids, create_function('$orderid', 'return preg_match("/^\\d{12}(|\\-\\d{12,14}|\\-0)$/i", $orderid)>0;'));
if (count($order_ids) == 0) {
return false;
}
$valid_orderids = array_map(create_function('$a', 'return "<OrderID>".$a."</OrderID>";'), $order_ids);
$requestXmlBody = '<?xml version="1.0" encoding="utf-8"?>
<' . $this->verb . 'Request xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>' . $this->requestToken . '</eBayAuthToken>
</RequesterCredentials>
<DetailLevel>ReturnAll</DetailLevel>
<IncludeFinalValueFee>true</IncludeFinalValueFee>
<OrderRole>Seller</OrderRole>
<OrderStatus>Completed</OrderStatus>
<OrderIDArray>' . "\n" . implode("\n\t", $valid_orderids) . "\n" . '</OrderIDArray>
</' . $this->verb . 'Request>';
return XML_unserialize($this->sendHttpRequest($requestXmlBody));
}
示例13: GetBankList
/**
* 商戶端獲取銀行列表查詢(WS)
* @param int $MerCode
* @param unknown_type $cert_md5
* @param unknown_type $ws_url
* @return
* pMerCode 6 “平台”賬號 否 由IPS頒發的商戶號 pErrCode 4 返回狀態 否 0000成功; 9999失敗;
* pErrMsg 100 返回信息 否 狀態0000:成功 除此乊外:反饋實際原因
* pBankList 銀行名稱|銀行卡別名|銀行卡編號#銀行名稱|銀行卡別名|銀行卡編號
* BankList[] = array('name'=>銀行名稱,'sub_name'=>銀行卡別名,'id'=>銀行卡編號);
*/
function GetBankList($MerCode, $cert_md5, $ws_url)
{
$str = $MerCode . $cert_md5;
$pSign = md5($str);
try {
$url = $ws_url;
$client = new SoapClient($url);
// 接口方法:public string GetBankList(string argMerCode, string argSign)
$param = array('argMerCode' => $MerCode, 'argSign' => $pSign);
$arrResult = $client->GetBankList($param);
$resultStr = $arrResult->GetBankListResult;
/*
* pMerCode 6 “平台”賬號 否 由IPS頒發的商戶號 pErrCode 4 返回狀態 否 0000成功; 9999失敗;
* pErrMsg 100 返回信息 否 狀態0000:成功 除此乊外:反饋實際原因
* pBankList 銀行名稱|銀行卡別名|銀行卡編號#銀行名稱|銀行卡別名|銀行卡編號
*/
require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
$str3ParaInfo = @XML_unserialize($resultStr);
//print_r($str3ParaInfo);exit;
$str3Req = $str3ParaInfo['pReq'];
$result = array();
$result['pErrCode'] = $str3Req["pErrCode"];
$result['pErrMsg'] = $str3Req["pErrMsg"];
$result['pBankList'] = $str3Req["pBankList"];
$list = explode('#', $result['pBankList']);
$BankList = array();
foreach ($list as $bank) {
$b = explode('|', $bank);
if (count($b) >= 3) {
$BankList[] = array('name' => $b[0], 'sub_name' => $b[1], 'id' => $b[2]);
}
}
$result['BankList'] = $BankList;
} catch (SOAPFault $e) {
$result = array();
$result['pErrCode'] = 9999;
$result['pErrMsg'] = print_r($e, 1);
$result['pBankList'] = '';
}
return $result;
}
示例14: sendEbayCsMail
public function sendEbayCsMail($itemId, $buyerId, $sendContent, $subject)
{
include_once WEB_PATH . 'lib/ebaylibrary/eBaySession.php';
global $devID, $appID, $certID, $serverUrl, $siteID, $compatabilityLevel, $userToken;
$verb = 'AddMemberMessageAAQToPartner';
$session = new eBaySession($userToken, $devID, $appID, $certID, $serverUrl, $compatabilityLevel, $siteID, $verb);
$requestXML = <<<EOF
<?xml version="1.0" encoding="utf-8"?>
<AddMemberMessageAAQToPartnerRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>{$userToken}</eBayAuthToken>
</RequesterCredentials>
<ItemID>{$itemId}</ItemID>
<MemberMessage>
<Subject>{$subject}</Subject>
<Body>{$sendContent}</Body>
<EmailCopyToSender>true</EmailCopyToSender>
<QuestionType>General</QuestionType>
<RecipientID>{$buyerId}</RecipientID>
</MemberMessage>
</AddMemberMessageAAQToPartnerRequest>
EOF;
$responseXml = $session->sendHttpRequest($requestXML);
if (stristr($responseXml, 'HTTP 404') || $responseXml == '' || $responseXml === FALSE) {
self::$errMsg = __METHOD__ . '發送請求失敗! in line ' . __LINE__;
return FALSE;
}
$data = XML_unserialize($responseXml);
$ack = $data['AddMemberMessageAAQToPartnerResponse'];
$ack = $ack['Ack'];
if ($ack == 'Success') {
return TRUE;
} else {
$err = $data['AddMemberMessageAAQToPartnerResponse']['Errors']['LongMessage'];
self::$errMsg = '處理失敗 ::ERR INFO ==> ' . $err;
return FALSE;
}
}
示例15: GuaranteeUnfreeze
/**
* 解凍保證金
* @param int $deal_id 標的號
* @param int $pUnfreezenType 解凍類型 否 1#解凍借款方;2#解凍擔保方
* @param float $money 解凍金額;默認為0時,則解凍所有未解凍的金額
* @param unknown_type $MerCode
* @param unknown_type $cert_md5
* @param unknown_type $post_url
* @return string
*/
function GuaranteeUnfreeze($deal_id, $pUnfreezenType, $money, $MerCode, $cert_md5, $ws_url)
{
$pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Ips&class_act=GuaranteeUnfreeze";
//web方式返回
$pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Ips&class_act=GuaranteeUnfreeze";
//s2s方式返回
$deal = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $deal_id);
if ($pUnfreezenType == 1) {
$user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . intval($deal['user_id']));
} else {
$user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . intval($deal['agency_id']));
}
$data = array();
$data['deal_id'] = $deal_id;
$data['pMerCode'] = $MerCode;
// '“平台”賬號 否 由IPS頒發的商戶號 ',
$data['pMerBillNo'] = $deal_id . 'U' . get_gmtime();
//商戶係統唯一丌重複 ',
$data['pBidNo'] = $deal_id;
//'標的號,商戶係統唯一丌重複',
$data['pUnfreezeDate'] = to_date(get_gmtime(), 'Ymd');
//'解凍日期格 式:yyyymmdd',
$data['pUnfreezenType'] = $pUnfreezenType;
//'解凍類型 否 1#解凍借款方;2#解凍擔保方',
$money = floatval($money);
if ($money == 0) {
if ($pUnfreezenType == 1) {
$money = $deal['real_freezen_amt'] - $deal['un_real_freezen_amt'];
//'解凍金額 金額單位,丌能為負,丌允許為0 累計解凍金額 <= 當時凍結時的保證金',
} else {
$money = $deal['guarantor_real_freezen_amt'] - $deal['un_guarantor_real_freezen_amt'];
}
}
$data['pUnfreezeAmt'] = str_replace(',', '', number_format($money, 2));
$data['pAcctType'] = 1;
//'解凍者賬戶類型 否 0#機構;1#個人',
$data['pIdentNo'] = $user['idno'];
//'解凍者證件號碼 是/否 解凍者賬戶類型1時:真實身份證(個人),必填 解凍賬戶類型0時:為空處理 ',
$data['pRealName'] = $user['real_name'];
//'解凍者姓名 否 賬戶類型為1時,真實姓名(中文) 賬戶類型為0時,開戶時在IPS登記的商戶名稱 '
$data['pIpsAcctNo'] = $user['ips_acct_no'];
//'解凍者IPS賬號 否 賬戶類型為1時,IPS個人托管賬戶號 賬戶類型為0時,由IPS頒發的商戶號',
$GLOBALS['db']->autoExecute(DB_PREFIX . "ips_guarantee_unfreeze", $data, 'INSERT');
$id = $GLOBALS['db']->insert_id();
$strxml = GuaranteeUnfreezeXml($data, $pWebUrl, $pS2SUrl);
//echo $strxml;exit;
$Crypt3Des = new Crypt3Des();
//new 3des class
$p3DesXmlPara = $Crypt3Des->DESEncrypt($strxml);
//3des 加密
$str = $MerCode . $p3DesXmlPara . $cert_md5;
$pSign = md5($str);
try {
$url = $ws_url;
$client = new SoapClient($url);
$param = array('argMerCode' => $MerCode, 'arg3DesXmlPara' => $p3DesXmlPara, 'argSign' => $pSign);
$arrResult = $client->GuaranteeUnfreeze($param);
$resultStr = $arrResult->GuaranteeUnfreezeResult;
require_once APP_ROOT_PATH . 'system/collocation/ips/ips.php';
require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
$result = @XML_unserialize($resultStr);
$result = $result['pReq'];
wsnotify($result, 'GuaranteeUnfreeze', $cert_md5);
$result['resultStr'] = $resultStr;
return $result;
} catch (SOAPFault $e) {
print $e;
//file_put_contents(PATH_LOG_FILE,PATH.$e."\r\n",FILE_APPEND);
}
}