Browse Source

wxnotify

master
dutsc 3 years ago
parent
commit
80dc8e593c
  1. 84
      mobile/source/helpers/dalianpay/demo/dalianpay.php
  2. 4
      mobile/source/helpers/dalianpay/library/Crypt.php

84
mobile/source/helpers/dalianpay/demo/dalianpay.php

@ -71,50 +71,50 @@ class dalianpay{
// echo "reqsn is " . $reqsn . "\n\r"; // echo "reqsn is " . $reqsn . "\n\r";
// echo "uniqid reqsn is " . uniqid($reqsn_prefix) . "\n\r"; // echo "uniqid reqsn is " . uniqid($reqsn_prefix) . "\n\r";
// echo "trxamt is " . $trxamt . "\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( $trade_data = array(
// 'body'=>'订单标题', 'orgid' => $config['org_num'],
'branchno'=>'401', // 'orgid' => '5503001',
'cusid'=>'100018380507D2C', 'cusid' => $config['cusid'],
'notify_url'=>'https://shop.heavenk.com/mobile/wxnotify.php', // 'cusid' => '10147',
'orgid'=>'100018380507D2C', 'branchno' => $config['branchno'],
'paytype'=>'A01', // 'branchno' => '44',
'producp'=>'JX0002', 'version' => $config['version'],
'randomstr'=>'a14cf3397a8163a76a2f229c41085a61', // 'version' => '11',
'reqsn'=>'2023081664dc2b9454389', // jsapi支付不需要termcode
'termcode'=>'000000', 'termcode' => $config['termcode'],
'transtype'=>'JSP511', 'trxamt' => strval($trxamt), // total_fee bug: need:string supply:int
'trxamt'=>'1', // 'trxamt' => '180000', // total_fee
'version'=>'11', '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); $sign = $Base->Crypt->makeSign($trade_data);

4
mobile/source/helpers/dalianpay/library/Crypt.php

@ -57,8 +57,9 @@ class Crypt
// 升序排列 // 升序排列
ksort($data); 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 = $data . '';
// 构建排序后的字符串 // 构建排序后的字符串
$pre_sign_str = ''; $pre_sign_str = '';
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
@ -67,6 +68,7 @@ class Crypt
// 移除末尾的多余字符 // 移除末尾的多余字符
$pre_sign_str = rtrim($sortedString, '&'); $pre_sign_str = rtrim($sortedString, '&');
echo "[pre_sign_str(jiao yi message)]: {$pre_sign_str}"; echo "[pre_sign_str(jiao yi message)]: {$pre_sign_str}";
// die(); // die();

Loading…
Cancel
Save