From 80dc8e593c431bc3b542db0cb09c3c6a71f72266 Mon Sep 17 00:00:00 2001 From: dutsc <1020018707@qq.com> Date: Wed, 16 Aug 2023 13:36:00 +0800 Subject: [PATCH] wxnotify --- mobile/source/helpers/dalianpay/demo/dalianpay.php | 84 +++++++++++----------- mobile/source/helpers/dalianpay/library/Crypt.php | 4 +- 2 files changed, 45 insertions(+), 43 deletions(-) diff --git a/mobile/source/helpers/dalianpay/demo/dalianpay.php b/mobile/source/helpers/dalianpay/demo/dalianpay.php index 8c084f4..d102242 100644 --- a/mobile/source/helpers/dalianpay/demo/dalianpay.php +++ b/mobile/source/helpers/dalianpay/demo/dalianpay.php @@ -71,50 +71,50 @@ class dalianpay{ // echo "reqsn is " . $reqsn . "\n\r"; // echo "uniqid reqsn is " . uniqid($reqsn_prefix) . "\n\r"; // echo "trxamt is " . $trxamt . "\n\r"; - // $trade_data = array( - // 'orgid' => $config['org_num'], - // // 'orgid' => '5503001', - // 'cusid' => $config['cusid'], - // // 'cusid' => '10147', - // 'branchno' => $config['branchno'], - // // 'branchno' => '44', - // 'version' => $config['version'], - // // 'version' => '11', - // // jsapi支付不需要termcode - // 'termcode' => $config['termcode'], - // 'trxamt' => strval($trxamt), // total_fee bug: need:string supply:int - // // 'trxamt' => '180000', // total_fee - // 'reqsn' => $reqsn, // 交易订单号 - // // 'reqsn' => uniqid($reqsn_prefix), // 交易订单号 - // 'producp' => $config['producp'], - // 'transtype' => $config['transtype'], // 微信支付 - // 'paytype' => $config['paytype'], // 微信js支付 - // 'randomstr' => md5( uniqid() ), - // 'body' => 'pages', - // // 'acct' => $openid, - // 'notify_url' => $config['notify_url'], // 交易结果通知地址 - // // 'limit_pay' => $config['limit_pay'], - // // 'sub_appid' => $config['sub_appid'], - // // 'front_url' => $config['front_url'], // 支付完成跳转 - // ); - // echo "\r\n test \r\n"; - - echo "please\r\n"; $trade_data = array( - // 'body'=>'订单标题', - 'branchno'=>'401', - 'cusid'=>'100018380507D2C', - 'notify_url'=>'https://shop.heavenk.com/mobile/wxnotify.php', - 'orgid'=>'100018380507D2C', - 'paytype'=>'A01', - 'producp'=>'JX0002', - 'randomstr'=>'a14cf3397a8163a76a2f229c41085a61', - 'reqsn'=>'2023081664dc2b9454389', - 'termcode'=>'000000', - 'transtype'=>'JSP511', - 'trxamt'=>'1', - 'version'=>'11', + 'orgid' => $config['org_num'], + // 'orgid' => '5503001', + 'cusid' => $config['cusid'], + // 'cusid' => '10147', + 'branchno' => $config['branchno'], + // 'branchno' => '44', + 'version' => $config['version'], + // 'version' => '11', + // jsapi支付不需要termcode + 'termcode' => $config['termcode'], + 'trxamt' => strval($trxamt), // total_fee bug: need:string supply:int + // 'trxamt' => '180000', // total_fee + 'reqsn' => $reqsn, // 交易订单号 + // 'reqsn' => uniqid($reqsn_prefix), // 交易订单号 + 'producp' => $config['producp'], + 'transtype' => $config['transtype'], // 微信支付 + 'paytype' => $config['paytype'], // 微信js支付 + 'randomstr' => md5( uniqid() ), + 'body' => 'pages', + // 'acct' => $openid, + 'notify_url' => $config['notify_url'], // 交易结果通知地址 + // 'limit_pay' => $config['limit_pay'], + // 'sub_appid' => $config['sub_appid'], + // 'front_url' => $config['front_url'], // 支付完成跳转 ); + // echo "\r\n test \r\n"; + + // echo "please\r\n"; + // $trade_data = array( + // // 'body'=>'订单标题', + // 'branchno'=>'401', + // 'cusid'=>'100018380507D2C', + // 'notify_url'=>'https://shop.heavenk.com/mobile/wxnotify.php', + // 'orgid'=>'100018380507D2C', + // 'paytype'=>'A01', + // 'producp'=>'JX0002', + // 'randomstr'=>'a14cf3397a8163a76a2f229c41085a61', + // 'reqsn'=>'2023081664dc2b9454389', + // 'termcode'=>'000000', + // 'transtype'=>'JSP511', + // 'trxamt'=>'1', + // 'version'=>'11', + // ); // 生成签名 $sign = $Base->Crypt->makeSign($trade_data); diff --git a/mobile/source/helpers/dalianpay/library/Crypt.php b/mobile/source/helpers/dalianpay/library/Crypt.php index 01f603b..9a6c87a 100644 --- a/mobile/source/helpers/dalianpay/library/Crypt.php +++ b/mobile/source/helpers/dalianpay/library/Crypt.php @@ -57,8 +57,9 @@ class Crypt // 升序排列 ksort($data); // 转字符串 - // $pre_sign_str = http_build_query($data,null,'&'); + // $pre_sign_str = http_build_query($data,null,'&'); // bug 这里默认进行url编码 导致Sign错误 // $pre_sign_str = $data . ''; + // 构建排序后的字符串 $pre_sign_str = ''; foreach ($data as $key => $value) { @@ -67,6 +68,7 @@ class Crypt // 移除末尾的多余字符 $pre_sign_str = rtrim($sortedString, '&'); + echo "[pre_sign_str(jiao yi message)]: {$pre_sign_str}"; // die();