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&');
        }
    }
}
 function response($request, $class_act)
 {
     //print_r($_POST);
     //print_r($_GET);
     //print_r($_REQUEST);
     //print_r($request);
     $merchant_id = $this->cfg['merchant_id'];
     $terminal_id = $this->cfg['terminal_id'];
     $key = $this->cfg['key'];
     $iv = $this->cfg['iv'];
     $baofoo_log = array();
     $baofoo_log['code'] = 'response';
     $baofoo_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s');
     $baofoo_log['strxml'] = $class_act;
     $baofoo_log['html'] = print_r($_POST, true);
     $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_log", $baofoo_log);
     //exit;
     $Md5sign = "";
     if ($class_act == 'CreateNewAcct' || $class_act == 'DoDpTrade' || $class_act == 'DoDwTrade') {
         //Md5sign = Md5(result + ~|~ + "商户密钥")
         $result = $_POST["result"];
         $sign = $_POST["sign"];
         $Md5sign = Md5($result . '~|~' . $key);
         require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
         $str3ParaInfo = @XML_unserialize($result);
         $str3Req = $str3ParaInfo['crs'];
     } else {
         if ($class_act == 'RegisterCreditor' || $class_act == 'DoLoans') {
             require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
             $result = $_POST["result"];
             $str3ParaInfo = @XML_unserialize($result);
             $str3Req = $str3ParaInfo['crs'];
             //Sign =  MD5 ( code + ~|~ + msg + ~|~ + orderId + ~|~+商户秘钥 );
             $Md5sign = Md5($str3Req['code'] . '~|~' . $str3Req['msg'] . '~|~' . $str3Req['order_id'] . '~|~' . $key);
             $sign = $str3Req["sign"];
         }
     }
     if ($Md5sign == $sign) {
         //echo "<br/>验签通过";exit;
         //
         $pErrMsg = $str3Req['msg'];
         if ($class_act == 'CreateNewAcct') {
             require_once APP_ROOT_PATH . 'system/collocation/baofoo/CreateNewAcct.php';
             $user_type = CreateNewAcctCallBack($str3Req);
             if ($request['from'] == 'app') {
                 showIpsInfo($pErrMsg);
             } else {
                 showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
             }
         } else {
             if ($class_act == 'DoDpTrade') {
                 require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoDpTrade.php';
                 DoDpTradeCallBack($str3Req);
                 $pErrMsg = '充值完成';
                 if ($request['from'] == 'app') {
                     showIpsInfo($pErrMsg);
                 } else {
                     if ($request['from'] == 'wap') {
                         showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                     } else {
                         showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                     }
                 }
             } else {
                 if ($class_act == 'DoDwTrade') {
                     require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoDwTrade.php';
                     DoDwTradeCallBack($str3Req);
                     $pErrMsg = '操作完成';
                     if ($request['from'] == 'app') {
                         showIpsInfo($pErrMsg);
                     } else {
                         if ($request['from'] == 'wap') {
                             showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                         } else {
                             showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                         }
                     }
                 } else {
                     if ($class_act == 'DoLoans') {
                         require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoLoans.php';
                         DoLoansCallBack($str3Req);
                         showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                     } else {
                         if ($class_act == 'RegisterCreditor') {
                             //投资,登记债权人
                             require_once APP_ROOT_PATH . 'system/collocation/baofoo/RegisterCreditor.php';
                             $ipsdata = RegisterCreditorCallBack($str3Req);
                             if ($request['from'] == 'app') {
                                 showIpsInfo($pErrMsg);
                             } else {
                                 if ($request['from'] == 'wap') {
                                     showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                                 } else {
                                     if ($ipsdata) {
                                         showIpsInfo($pErrMsg, url("index", "deal", array("id" => $ipsdata['deal_id'])));
                                     } else {
                                         showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
         echo "<br/>验签不通过";
         exit;
     }
 }
 function response($request, $class_act)
 {
     //print_r($request); exit;
     $yeepay_log = array();
     $yeepay_log['code'] = 'response';
     $yeepay_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s');
     $yeepay_log['strxml'] = $_POST["resp"];
     $yeepay_log['html'] = $_POST["sign"];
     $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log);
     $resp = $_POST["resp"];
     $sign = $_POST["sign"];
     $localSign = $sign;
     //正式版本,需要加上验证;
     if ($localSign == $sign) {
         //echo "<br/>验签通过";exit;
         //echo $resp;
         require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
         $str3ParaInfo = @XML_unserialize($resp);
         $str3Req = $str3ParaInfo['response'];
         //
         if ($class_act == 'CreateNewAcct') {
             require_once APP_ROOT_PATH . 'system/collocation/yeepay/CreateNewAcct.php';
             $user_type = CreateNewAcctCallBack($str3Req);
             if ($request['from'] == 'app') {
                 showIpsInfo($str3Req["description"]);
             } else {
                 if ($request['from'] == 'wap') {
                     showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                 } else {
                     showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT);
                 }
             }
         } else {
             if ($class_act == 'DoDpTrade') {
                 require_once APP_ROOT_PATH . 'system/collocation/yeepay/DoDpTrade.php';
                 DoDpTradeCallBack($str3Req);
                 if ($request['from'] == 'app') {
                     showIpsInfo($str3Req["description"]);
                 } else {
                     if ($request['from'] == 'wap') {
                         showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                     } else {
                         showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT);
                     }
                 }
             } else {
                 if ($class_act == 'BindBankCard') {
                     require_once APP_ROOT_PATH . 'system/collocation/yeepay/BindBankCard.php';
                     BindBankCardCallBack($str3Req);
                     if ($request['from'] == 'app') {
                         showIpsInfo($str3Req["description"]);
                     } else {
                         if ($request['from'] == 'wap') {
                             showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                         } else {
                             showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT);
                         }
                     }
                 } else {
                     if ($class_act == 'DoDwTrade') {
                         require_once APP_ROOT_PATH . 'system/collocation/yeepay/DoDwTrade.php';
                         DoDwTradeCallBack($str3Req);
                         if ($request['from'] == 'app') {
                             showIpsInfo($str3Req["description"]);
                         } else {
                             if ($request['from'] == 'wap') {
                                 showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                             } else {
                                 showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT);
                             }
                         }
                     } else {
                         if ($class_act == 'DoBids') {
                             require_once APP_ROOT_PATH . 'system/collocation/yeepay/DoBids.php';
                             DoBidsCallBack($str3Req);
                             if ($request['from'] == 'app') {
                                 showIpsInfo($str3Req["description"]);
                             } else {
                                 if ($request['from'] == 'wap') {
                                     showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                                 } else {
                                     showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT);
                                 }
                             }
                         } else {
                             if ($class_act == 'RegisterCreditor') {
                                 //投资,登记债权人
                                 require_once APP_ROOT_PATH . 'system/collocation/yeepay/RegisterCreditor.php';
                                 $ipsdata = RegisterCreditorCallBack($str3Req);
                                 if ($request['from'] == 'app') {
                                     showIpsInfo($str3Req["description"]);
                                 } else {
                                     if ($request['from'] == 'wap') {
                                         showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                                     } else {
                                         if ($ipsdata) {
                                             showIpsInfo($str3Req["description"], url("index", "deal", array("id" => $ipsdata['deal_id'])));
                                         } else {
                                             showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT);
                                         }
                                     }
                                 }
                             } else {
                                 if ($class_act == 'DoLoans') {
                                     require_once APP_ROOT_PATH . 'system/collocation/yeepay/DoLoans.php';
                                     $ipsdata = RepaymentNewTradeCallBack($str3Req);
                                     if ($request['from'] == 'app') {
                                         showIpsInfo($str3Req["description"]);
                                     } else {
                                         if ($request['from'] == 'wap') {
                                             showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                                         } else {
                                             if ($ipsdata) {
                                                 showIpsInfo($ipsdata["info"], SITE_DOMAIN . APP_ROOT . "/m.php?m=Deal&a=full");
                                             } else {
                                                 showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT);
                                             }
                                         }
                                     }
                                 } else {
                                     if ($class_act == 'RepaymentNewTrade') {
                                         require_once APP_ROOT_PATH . 'system/collocation/yeepay/RepaymentNewTrade.php';
                                         $ipsdata = RepaymentNewTradeCallBack($str3Req, $this->platformNo, $this->post_url);
                                         if ($request['from'] == 'app') {
                                             showIpsInfo($str3Req["description"]);
                                         } else {
                                             if ($request['from'] == 'wap') {
                                                 showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                                             } else {
                                                 if ($ipsdata) {
                                                     showIpsInfo($str3Req["description"], url("index", "uc_deal#quick_refund", array("id" => $ipsdata['deal_id'])));
                                                 } else {
                                                     showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT);
                                                 }
                                             }
                                         }
                                     } else {
                                         if ($class_act == 'RepaymentRepayCallBack') {
                                             require_once APP_ROOT_PATH . 'system/collocation/yeepay/RepaymentNewTrade.php';
                                             $ipsdata = RepaymentRepayCallBack($str3Req);
                                             if ($request['from'] == 'app') {
                                                 showIpsInfo($str3Req["description"]);
                                             } else {
                                                 if ($request['from'] == 'wap') {
                                                     showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                                                 } else {
                                                     if ($ipsdata) {
                                                         showIpsInfo($str3Req["description"], url("index", "uc_deal#quick_refund", array("id" => $ipsdata['deal_id'])));
                                                     } else {
                                                         showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT);
                                                     }
                                                 }
                                             }
                                         } else {
                                             if ($class_act == 'RegisterCretansfer') {
                                                 require_once APP_ROOT_PATH . 'system/collocation/yeepay/RegisterCretansfer.php';
                                                 RegisterCretansferCallBack($str3Req, $this->platformNo, $this->post_url);
                                                 if ($request['from'] == 'app') {
                                                     showIpsInfo($str3Req["description"]);
                                                 } else {
                                                     if ($request['from'] == 'wap') {
                                                         showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                                                     } else {
                                                         if ($request['from'] == 'app') {
                                                             showIpsInfo($str3Req["description"]);
                                                         } else {
                                                             showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT);
                                                         }
                                                     }
                                                 }
                                             } else {
                                                 if ($class_act == 'RegisterCretansferBack') {
                                                     require_once APP_ROOT_PATH . 'system/collocation/yeepay/RegisterCretansfer.php';
                                                     RegisterCretansferBack($str3Req);
                                                     if ($request['from'] == 'app') {
                                                         showIpsInfo($str3Req["description"]);
                                                     } else {
                                                         if ($request['from'] == 'wap') {
                                                             showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                                                         } else {
                                                             if ($request['from'] == 'app') {
                                                                 showIpsInfo($str3Req["description"]);
                                                             } else {
                                                                 showIpsInfo($str3Req["description"], SITE_DOMAIN . APP_ROOT);
                                                             }
                                                         }
                                                     }
                                                 } else {
                                                     if ($class_act == 'Transfer') {
                                                         require_once APP_ROOT_PATH . 'system/collocation/ips/Transfer.php';
                                                         $result = TransferCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                                                         if ($request['from'] == 'app') {
                                                             showIpsInfo($pErrMsg);
                                                         } else {
                                                             if ($request['from'] == 'wap') {
                                                                 if (intval($str3Req["pTransferType"]) == 4) {
                                                                     showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                                                                 } else {
                                                                     showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                                                                 }
                                                             } else {
                                                                 if (intval($str3Req["pTransferType"]) == 4) {
                                                                     showIpsInfo($pErrMsg, url("index", "transfer#detail", array("id" => $result['id'])));
                                                                 } else {
                                                                     showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
         echo "<br/>验签不通过:{$localSign}";
         exit;
     }
 }
 function response($request, $class_act)
 {
     //print_r($request); exit;
     $pMerCode = $request["pMerCode"];
     $pErrCode = $request["pErrCode"];
     $pErrMsg = $request["pErrMsg"];
     $p3DesXmlPara = $request["p3DesXmlPara"];
     $pSign = $request["pSign"];
     $signPlainText = $pMerCode . $pErrCode . $pErrMsg . $p3DesXmlPara . $this->cert_md5;
     $localSign = md5($signPlainText);
     if ($localSign == $pSign) {
         //echo "<br/>验签通过";exit;
         $Crypt3Des = new Crypt3Des();
         //new 3des class
         $str3XmlParaInfo = $Crypt3Des->DESDecrypt($p3DesXmlPara);
         //3des解密
         require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
         $str3ParaInfo = @XML_unserialize($str3XmlParaInfo);
         $str3Req = $str3ParaInfo['pReq'];
         //
         if ($class_act == 'CreateNewAcct') {
             require_once APP_ROOT_PATH . 'system/collocation/ips/CreateNewAcct.php';
             $user_type = CreateNewAcctCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
             if ($request['from'] == 'app') {
                 showIpsInfo($pErrMsg);
             } else {
                 showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
             }
         } else {
             if ($class_act == 'RegisterSubject') {
                 require_once APP_ROOT_PATH . 'system/collocation/ips/RegisterSubject.php';
                 RegisterSubjectCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                 showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
             } else {
                 if ($class_act == 'RegisterCreditor') {
                     //投资,登记债权人
                     require_once APP_ROOT_PATH . 'system/collocation/ips/RegisterCreditor.php';
                     $ipsdata = RegisterCreditorCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                     if ($request['from'] == 'app') {
                         showIpsInfo($pErrMsg);
                     } else {
                         if ($request['from'] == 'wap') {
                             showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                         } else {
                             if ($ipsdata) {
                                 showIpsInfo($pErrMsg, url("index", "deal", array("id" => $ipsdata['deal_id'])));
                             } else {
                                 showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                             }
                         }
                     }
                 } else {
                     if ($class_act == 'RegisterCretansfer') {
                         require_once APP_ROOT_PATH . 'system/collocation/ips/RegisterCretansfer.php';
                         RegisterCretansferCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                         if ($request['from'] == 'app') {
                             showIpsInfo($pErrMsg);
                         } else {
                             showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                         }
                     } else {
                         if ($class_act == 'GuaranteeUnfreeze') {
                             require_once APP_ROOT_PATH . 'system/collocation/ips/GuaranteeUnfreeze.php';
                             GuaranteeUnfreezeCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                             showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                         } else {
                             if ($class_act == 'DoDpTrade') {
                                 require_once APP_ROOT_PATH . 'system/collocation/ips/DoDpTrade.php';
                                 DoDpTradeCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                                 if ($request['from'] == 'app') {
                                     showIpsInfo($pErrMsg);
                                 } else {
                                     if ($request['from'] == 'wap') {
                                         showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                                     } else {
                                         showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                                     }
                                 }
                             } else {
                                 if ($class_act == 'DoDwTrade') {
                                     require_once APP_ROOT_PATH . 'system/collocation/ips/DoDwTrade.php';
                                     DoDwTradeCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                                     if ($request['from'] == 'app') {
                                         showIpsInfo($pErrMsg);
                                     } else {
                                         if ($request['from'] == 'wap') {
                                             showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                                         } else {
                                             showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                                         }
                                     }
                                 } else {
                                     if ($class_act == 'RegisterGuarantor') {
                                         require_once APP_ROOT_PATH . 'system/collocation/ips/RegisterGuarantor.php';
                                         RegisterGuarantorCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                                         showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                                     } else {
                                         if ($class_act == 'RepaymentNewTrade') {
                                             require_once APP_ROOT_PATH . 'system/collocation/ips/RepaymentNewTrade.php';
                                             $ipsdata = RepaymentNewTradeCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                                             if ($ipsdata) {
                                                 showIpsInfo($pErrMsg, url("index", "uc_deal#quick_refund", array("id" => $ipsdata['deal_id'])));
                                             } else {
                                                 showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                                             }
                                         } else {
                                             if ($class_act == 'Transfer') {
                                                 require_once APP_ROOT_PATH . 'system/collocation/ips/Transfer.php';
                                                 $result = TransferCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                                                 if ($request['from'] == 'app') {
                                                     showIpsInfo($pErrMsg);
                                                 } else {
                                                     if ($request['from'] == 'wap') {
                                                         if (intval($str3Req["pTransferType"]) == 4) {
                                                             showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT . '/wap/index.php?ctl=uc_center');
                                                         } else {
                                                             showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                                                         }
                                                     } else {
                                                         if (intval($str3Req["pTransferType"]) == 4) {
                                                             showIpsInfo($pErrMsg, url("index", "transfer#detail", array("id" => $result['id'])));
                                                         } else {
                                                             showIpsInfo($pErrMsg, SITE_DOMAIN . APP_ROOT);
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
         echo "<br/>验签不通过:{$localSign}";
         exit;
     }
 }
function SincerityGoldFreeze($user_id, $platformNo, $pTrdAmt, $deal_id, $from, $post_url, $sys = 'pc')
{
    //$pWebUrl= SITE_DOMAIN.APP_ROOT."/index.php?ctl=collocation&act=response&class_name=Yeepay&class_act=SincerityGoldFreeze&from=".$_REQUEST['from'];//web方式返回
    //$pS2SUrl= SITE_DOMAIN.APP_ROOT."/index.php?ctl=collocation&act=notify&class_name=Yeepay&class_act=SincerityGoldFreeze&from=".$_REQUEST['from'];//s2s方式返回
    $user = array();
    $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
    $yeepay_log = array();
    $yeepay_log['code'] = 'FREEZE';
    $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['requestNo'] = $requestNo;
    //请求流水号
    $data['platformUserNo'] = $user_id;
    //
    $data['platformNo'] = $platformNo;
    // 商户编号
    $data['amount'] = $pTrdAmt;
    //$data['feeMode'] = 'PLATFORM';//费率模式PLATFORM
    $data['deal_id'] = $deal_id;
    $data['expired'] = to_date(NOW_TIME + 3600 * 12 + 3600 * 24 * 30 * app_conf("MORTGAGE_MONEY_UNFREEZE"), "Y-m-d H:i:s");
    //到期自动解冻时间
    //	$strxml = SincerityGoldFreezeXml($data,$pWebUrl,$pS2SUrl);
    /* 请求参数 */
    $req = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" . "<request platformNo='" . $data['platformNo'] . "'>" . "<requestNo>" . $data['requestNo'] . "</requestNo>" . "<platformUserNo>" . $data['platformUserNo'] . "</platformUserNo>" . "<amount>" . $data['amount'] . "</amount>" . "<expired>" . $data['expired'] . "</expired>" . "</request>";
    /* 签名数据 */
    $sign = cfca($req);
    /* 调用账户查询服务 */
    $service = "FREEZE";
    $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 && $str3Req["description"] == "操作成功") {
            //操作成功
            $data['code'] = $str3Req["code"];
            //1 成功 0 失败 2 xml参数格式错误 3 签名验证失败 101 引用了不存在的对象(例如错误的订单号) 102 业务状态不正确 103 由于业务限制导致业务不能执行 104 实名认证失败
            $data['is_callback'] = 1;
            $data['status'] = 1;
            $data['pay_type'] = 0;
            $data['create_time'] = NOW_TIME;
            if (isset($str3Req['description'])) {
                $data['description'] = $str3Req["description"];
            }
            $GLOBALS['db']->autoExecute(DB_PREFIX . "money_freeze", $data, 'INSERT');
            $id = $GLOBALS['db']->insert_id();
            if ($from == 'web') {
                showIpsInfo('诚意金支付成功', url("deal#show", array("id" => $deal_id)));
            } elseif ($from == 'wap') {
                showIpsInfo('诚意金支付成功', url_wap("deal#index", array("id" => $deal_id)));
            } elseif ($from == 'app') {
                echo "诚意金支付成功<br />请点左上角<b>返回</b>按钮";
            }
        } else {
            if ($from == 'web') {
                showIpsInfo($str3Req["description"], url("deal#show", array("id" => $deal_id)));
            } elseif ($from == 'wap') {
                showIpsInfo($str3Req["description"], url_wap("deal#index", array("id" => $deal_id)));
            } elseif ($from == 'app') {
                echo $str3Req["description"] . "<br />请点左上角<b>返回</b>按钮";
            }
        }
    }
}
Exemple #6
0
function DoLoansCallBack($str3Req)
{
    $requestNo = $str3Req["requestNo"];
    $platformNo = $str3Req["platformNo"];
    $GLOBALS['db']->query("update " . DB_PREFIX . "yeepay_cp_transaction set is_callback = 1 where is_callback = 0 and requestNo = " . $requestNo);
    $result['pErrCode'] = $str3Req["code"];
    $result['pErrMsg'] = $str3Req["message"];
    $result['pIpsAcctNo'] = $str3Req["requestNo"];
    if ($str3Req["code"] == 1) {
        $sql = "update " . DB_PREFIX . "yeepay_cp_transaction set is_complete_transaction = 1,update_time = " . TIME_UTC . " where is_callback = 1 and requestNo = " . $requestNo;
        $GLOBALS['db']->query($sql);
        $deal_load = array();
        $deal_load['is_has_loans'] = 1;
        //1#转账成功
        $where = " pP2PBillNo = " . $requestNo;
        $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_load", $deal_load, 'UPDATE', $where);
    }
    $ipsdata = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "yeepay_cp_transaction where is_callback = 1 and requestNo =" . $requestNo);
    $count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_load where is_has_loans = 0 and deal_id = " . $ipsdata["tenderOrderNo"]);
    if ($count == 0) {
        //已经全部放款完成,生成:还款计划以及回款计划;
        $repay_start_time = intval($ipsdata['repay_start_time']);
        require_once APP_ROOT_PATH . "app/Lib/common.php";
        $result = do_loans($ipsdata["tenderOrderNo"], $repay_start_time, 1);
        showIpsInfo($result["info"], SITE_DOMAIN . APP_ROOT . "/m.php?m=Deal&a=full");
    } else {
        return 1;
    }
}