function getGopayServerTime()
 {
     $url = "https://mertest.gopay.com.cn/PGServer/time";
     //如果方法报错,请修改参数为http://mertest.gopay.com.cn/PGServer/time
     $bits = parse_url($url);
     $host = $bits['host'];
     $port = isset($bits['port']) ? $bits['port'] : 80;
     $path = isset($bits['path']) ? $bits['path'] : '/';
     if (isset($bits['query'])) {
         $path .= '?' . $bits['query'];
     }
     $client = new Sp_Payment_Gopay_HttpClient($host, $port);
     if (!$client->get($path)) {
         return false;
     } else {
         return $client->getContent();
     }
 }
 /**
  * 支付完成后返回处理(异步)
  * 
  * @param array params
  * @return void
  */
 public function notify($params)
 {
     $view = new Sp_View();
     #	解析返回参数.
     $version = $params["version"];
     $charset = $params["charset"];
     $language = $params["language"];
     $signType = $params["signType"];
     $tranCode = $params["tranCode"];
     $merchantID = $params["merchantID"];
     $merOrderNum = $params["merOrderNum"];
     $tranAmt = $params["tranAmt"];
     $feeAmt = $params["feeAmt"];
     $frontMerUrl = $params["frontMerUrl"];
     $backgroundMerUrl = $params["backgroundMerUrl"];
     $tranDateTime = $params["tranDateTime"];
     $tranIP = $params["tranIP"];
     $respCode = $params["respCode"];
     $msgExt = $params["msgExt"];
     $orderId = $params["orderId"];
     $gopayOutOrderId = $params["gopayOutOrderId"];
     $bankCode = $params["bankCode"];
     $tranFinishTime = $params["tranFinishTime"];
     $merRemark1 = $params["merRemark1"];
     $merRemark2 = $params["merRemark2"];
     $signValue = $params["signValue"];
     #	判断返回签名是否正确(True/False)
     $bRet = Sp_Payment_Gopay_HttpClient::CheckHmac($version, $tranCode, $merchantID, $merOrderNum, $tranAmt, $feeAmt, $tranDateTime, $frontMerUrl, $backgroundMerUrl, $orderId, $gopayOutOrderId, $tranIP, $respCode, '', self::$verficationCode, $signValue);
     if ($bRet) {
         if ($respCode == '0000') {
             $sn = trim($merOrderNum);
             //订单号
             $amount = floatval($tranAmt);
             //金额
             $recharge_info = Sp_Trade_Recharge::getBySn($sn);
             $amount_num = 1;
             if (floatval($recharge_info['amount']) == $amount) {
                 $ret = false;
                 if ($recharge_info['status'] == 1) {
                     $request = Request::current();
                     if ($request->isMobile()) {
                         echo 'RespCode=0000|JumpURL=' . SP_URL_WAP . 'moneyrecord.html';
                     } else {
                         echo 'RespCode=0000|JumpURL=' . SP_URL_USER . 'moneyrecord.html';
                     }
                     exit;
                 } elseif ($recharge_info['status'] < 1) {
                     $amount_num = Sp_Trade_Recharge::getUserRechargeReport('WHERE status = 1 AND user_id=' . $recharge_info['user_id']);
                     $param = array('id' => $recharge_info['id'], 'user_id' => $recharge_info['user_id'], 'sn' => $sn, 'amount' => $amount, 'bank_sn' => $_REQUEST['gopayOutOrderId'], 'trd_sn' => $_REQUEST['orderId'], 'remark' => json_encode($_REQUEST));
                     $ret = Sp_Trade_Tradeprocess::recharge($param);
                 }
                 if ($ret) {
                     //处理成功
                     //首冲奖励
                     if ($amount_num == 0) {
                         $active_send_info = array('uid' => $recharge_info['user_id'], 'type' => 'first_recharge');
                         $client_active = MQClient::factory('active');
                         $client_active->send('activePrizeReset_new_register', $active_send_info);
                     }
                     $user = Sp_Account_User::getUserBase($recharge_info['user_id']);
                     //用户信息
                     $data = array('user_id' => $recharge_info['user_id'], 'account' => $amount, 'user_name' => $user->data["username"], 'email' => $user->data['email'], 'realname' => $user->data["username"], 'phone' => $user->data['phone']);
                     Sp_Message::send('recharge', $data);
                     //发送消息
                     $request = Request::current();
                     if ($request->isMobile()) {
                         echo 'RespCode=0000|JumpURL=' . SP_URL_WAP . 'moneyrecord.html';
                     } else {
                         echo 'RespCode=0000|JumpURL=' . SP_URL_USER . 'moneyrecord.html';
                     }
                 } else {
                     echo 'RespCode=9999|JumpURL=';
                     $body = print_r($_REQUEST, true);
                     Sp_Admin_Mail::send('*****@*****.**', '国付宝支付失败(数据库处理失败)', $body);
                 }
             }
         } else {
             $body = print_r($_REQUEST, true);
             Sp_Admin_Mail::send('*****@*****.**', '国付宝支付失败(国付宝处理失败)', $body);
             echo 'RespCode=9999|JumpURL=';
         }
     } else {
         $body = print_r($_REQUEST, true);
         Sp_Admin_Mail::send('*****@*****.**', '国付宝支付失败(签名验证失败)', $body);
         echo 'RespCode=9999|JumpURL=';
         exit;
     }
 }