作者 王智

修改

... ... @@ -426,8 +426,8 @@ class Common extends Api
'payment' => [
'merchant_id' => '1603658973',
'key' => '8695A8185xyzKcdEVfreewayShenzhen',
'cert_path' => '/home/wwwroot/fast/book/addons/epay/certs/apiclient_cert.pem', // XXX: 绝对路径!!!!
'key_path' => '/home/wwwroot/fast/book/addons/epay/certs/apiclient_key.pem', // XXX: 绝对路径!!!!
'cert_path' => '/home/wwwroot/fast/kcd/addons/epay/certs/apiclient_cert.pem', // XXX: 绝对路径!!!!
'key_path' => '/home/wwwroot/fast/kcd/addons/epay/certs/apiclient_key.pem', // XXX: 绝对路径!!!!
],
];
$app = new Application($config);
... ... @@ -510,8 +510,8 @@ class Common extends Api
'payment' => [
'merchant_id' => '1603658973',
'key' => '8695A8185xyzKcdEVfreewayShenzhen',
'cert_path' => '/home/wwwroot/fast/book/addons/epay/certs/apiclient_cert.pem', // XXX: 绝对路径!!!!
'key_path' => '/home/wwwroot/fast/book/addons/epay/certs/apiclient_key.pem', // XXX: 绝对路径!!!!
'cert_path' => '/home/wwwroot/fast/kcd/addons/epay/certs/apiclient_cert.pem', // XXX: 绝对路径!!!!
'key_path' => '/home/wwwroot/fast/kcd/addons/epay/certs/apiclient_key.pem', // XXX: 绝对路径!!!!
],
];
$app = new Application($config);
... ...
<?php
namespace app\common\controller;
use EasyWeChat\Foundation\Application;
use app\common\library\Auth;
use think\Config;
use think\exception\HttpResponseException;
... ... @@ -14,7 +14,7 @@ use think\Response;
use think\Route;
use think\Validate;
use think\Db;
use EasyWeChat\Factory;
//use EasyWeChat\Factory;
/**
* API控制器基类
*/
... ... @@ -399,13 +399,14 @@ class Api
'payment' => [
'merchant_id' => '1603658973',
'key' => '8695A8185xyzKcdEVfreewayShenzhen',
'cert_path' => '/home/wwwroot/fast/book/addons/epay/certs/apiclient_cert.pem', // XXX: 绝对路径!!!!
'key_path' => '/home/wwwroot/fast/book/addons/epay/certs/apiclient_key.pem', // XXX: 绝对路径!!!!
'cert_path' => '/home/wwwroot/fast/kcd/addons/epay/certs/apiclient_cert.pem', // XXX: 绝对路径!!!!
'key_path' => '/home/wwwroot/fast/kcd/addons/epay/certs/apiclient_key.pem', // XXX: 绝对路径!!!!
],
];
$app = Factory::officialAccount($config);
$app = new Application($config);
$payment = $app->payment;
try {
$result = $app->refund->byTransactionId($PayOrderInfo['WeChatOrder'], $PayOrderInfo['PayOrder'], $PayOrderInfo['money'] * 100, $TuiMoney); // 总金额 100, 退款 80,操作员:商户号
$result = $payment->refundByTransactionId($PayOrderInfo['WeChatOrder'], $PayOrderInfo['PayOrder'], $PayOrderInfo['money'] * 100, $TuiMoney); // 总金额 100, 退款 80,操作员:商户号
//更改订单状态为已退款
Db::name('pay_order')->where('OrderSn', $OrderSn)->where('PayOrder', $PayOrderInfo['PayOrder'])->update(['type' => 0]);
} catch (Exception $e) {
... ...