|
|
|
@ -167,6 +167,30 @@ class wxpay |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 对openid加密的算法 |
|
|
|
*/ |
|
|
|
public function encrypt($plaintext) { |
|
|
|
$length = mb_strlen($plaintext); |
|
|
|
$ciphertext = ''; |
|
|
|
for ($i = 0; $i < $length; $i += 2) { |
|
|
|
$ciphertext .= mb_substr($plaintext, $i + 1, 1) . mb_substr($plaintext, $i, 1); |
|
|
|
} |
|
|
|
return $ciphertext; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 对openid解密的算法 |
|
|
|
*/ |
|
|
|
public function decrypt($ciphertext) { |
|
|
|
$length = mb_strlen($ciphertext); |
|
|
|
$plaintext = ''; |
|
|
|
for ($i = 0; $i < $length; $i += 2) { |
|
|
|
$plaintext .= mb_substr($ciphertext, $i + 1, 1) . mb_substr($ciphertext, $i, 1); |
|
|
|
} |
|
|
|
return $plaintext; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成支付代码 |
|
|
|
* @param array $order 订单信息 |
|
|
|
* @param array $payment 支付方式信息 |
|
|
|
@ -204,7 +228,11 @@ class wxpay |
|
|
|
var_dump($url); |
|
|
|
$_SESSION['prev_url'] = $url; |
|
|
|
var_dump($_SESSION['prev_url']); |
|
|
|
header('Location: https://shop.heavenk.com/mobile/dalianpay/demo/pay.php?openid=' . $_SESSION['openid'] . '&reqsn=' . $order['order_sn'] . '&trxamt=' . $order_amount); |
|
|
|
header('Location: https://shop.heavenk.com/mobile/dalianpay/demo/pay.php?openid=' . |
|
|
|
$this->encrypt($_SESSION['openid']) . |
|
|
|
'&reqsn=' . $order['order_sn'] . |
|
|
|
'&trxamt=' . $order_amount |
|
|
|
); |
|
|
|
// // header('Location: https://www.baidu.com'); |
|
|
|
// exit; // 终止当前脚本的执行,确保页面跳转生效 |
|
|
|
// require_once('../../demo/pay.php'); |
|
|
|
|