diff --git a/webapp/controller/PayController.class.php b/webapp/controller/PayController.class.php index b750fbb..cd57aab 100644 --- a/webapp/controller/PayController.class.php +++ b/webapp/controller/PayController.class.php @@ -97,11 +97,11 @@ class PayController { 'Amount' => '0.1', 'Subject' => '1', 'Desc' => '1', - 'CompanyNo' => '1', + 'CompanyNo' => 'sweep-b863b489a9b14ed4b895b181a2dab983', 'RandomStr' => $orderid, 'SignInfo' => '', 'AdviceUrl' => htmlentities($advice_url), - 'SubAppid' => '1', + 'SubAppid' => 'wx7d6509053659d9ed', 'UserId' => '1' ); $params['SignInfo'] = $this->_reaEncode( @@ -118,9 +118,6 @@ class PayController { echo $xml_txt; $requestDomain = base64_encode($xml_txt); $response = ''; - echo '???'; - echo urlencode($requestDomain); - echo '||||'; if (phpcommon\HttpClient::post(self::SCAN_PAY_API_URL, 'requestDomain='. urlencode($requestDomain), $response) @@ -132,7 +129,7 @@ class PayController { die();*/ } var_dump(base64_decode($response)); - $xmlobj = new \SimpleXMLElement($response); + $xmlobj = new \SimpleXMLElement(base64_decode($response)); var_dump($xmlobj->respCode); if ($xmlobj->respCode == '0000') { $conn = $this->getMysql($_REQUEST['account_id']); @@ -209,4 +206,89 @@ class PayController { } } + public function merchantIn() + { + $orderid = $this->getOrderId(); + if (empty($orderid)) { + die(); + } + $params = array( + 'MerNo' => self::MER_NO, + 'SignInfo' => '', + 'PayType' => 'WXZF_ONLINE', + 'RandomStr' => $orderid, + 'ChannelNo' => '', + 'MerchantInfo' => array( + 'MerName' => '', + 'ShortName' => '', + 'ContactName' => '', + 'Business' => '', + ) + ); + $params['SignInfo'] = $this->_reaEncode( + 'AdviceUrl=' . $advice_url . '&' . + 'Amount=' . $params['Amount'] . '&' . + 'MerchantNo=' . $params['MerchantNo'] . '&' . + 'MerchantOrderNo=' . $params['MerchantOrderNo'] . '&' . + 'PayType=' . $params['PayType'] . '&' . + 'RandomStr=' . $params['RandomStr'] . + '' + ); + $xml_txt = phpcommon\objectToXml($params, ''); + $xml_txt = str_replace('', '', $xml_txt); + $requestDomain = base64_encode($xml_txt); + $response = ''; + if (phpcommon\HttpClient::post(self::SCAN_PAY_API_URL, + 'requestDomain='. urlencode($requestDomain), + $response) + ) { + /* echo json_encode(array( + 'errcode' => 101, + 'errmsg' => '交易失败:' . $response, + )); + die();*/ + } + var_dump($response); + } + + public function merchantInQuery() + { + $orderid = $this->getOrderId(); + if (empty($orderid)) { + die(); + } + $params = array( + 'MerNo' => self::MER_NO, + 'SignInfo' => '', + 'PayType' => 'WXZF_ONLINE', + 'RandomStr' => $orderid, + 'CompanyNo' => '', + 'PayType' => 'WXZF_ONLINE', + ); + $params['SignInfo'] = $this->_reaEncode( + 'AdviceUrl=' . $advice_url . '&' . + 'Amount=' . $params['Amount'] . '&' . + 'MerchantNo=' . $params['MerchantNo'] . '&' . + 'MerchantOrderNo=' . $params['MerchantOrderNo'] . '&' . + 'PayType=' . $params['PayType'] . '&' . + 'RandomStr=' . $params['RandomStr'] . + '' + ); + $xml_txt = phpcommon\objectToXml($params, ''); + $xml_txt = str_replace('', '', $xml_txt); + $requestDomain = base64_encode($xml_txt); + $response = ''; + if (phpcommon\HttpClient::post(self::SCAN_PAY_API_URL, + 'requestDomain='. urlencode($requestDomain), + $response) + ) { + /* echo json_encode(array( + 'errcode' => 101, + 'errmsg' => '交易失败:' . $response, + )); + die();*/ + } + var_dump($response); + } + }