diff --git a/application/extra/wechat.php b/application/extra/wechat.php index b8d1b8b37..5f5a9e12c 100644 --- a/application/extra/wechat.php +++ b/application/extra/wechat.php @@ -17,13 +17,13 @@ * @return array */ return [ - 'token' => 'mytoken', - 'appid' => 'wx60a43dd8161666d4', - 'appsecret' => '5ac28d66f7c4dc20ca9e729ccb09b9b1', - 'encodingaeskey' => 'eHSmk5yJN2vSsuYscC8aHIiXnrgXZSKA4MRL9csEwTv', - 'mch_id' => '1332187001', - 'partnerkey' => 'A82DC5BD1F3359081049C568D8502BC5', - 'ssl_cer' => __DIR__ . '/cert/apiclient_cert.pem', - 'ssl_key' => __DIR__ . '/cert/apiclient_key.pem', - 'cachepath' => RUNTIME_PATH . 'wechat/pay', + 'token' => sysconf('wechat_token'), + 'appid' => sysconf('wechat_appid'), + 'appsecret' => sysconf('wechat_appsecret'), + 'encodingaeskey' => sysconf('wechat_encodingaeskey'), + 'mch_id' => sysconf('wechat_mch_id'), + 'partnerkey' => sysconf('wechat_partnerkey'), + 'ssl_cer' => sysconf('wechat_cert_cert'), + 'ssl_key' => sysconf('wechat_cert_key'), + 'cachepath' => CACHE_PATH . 'wxpay' . DS, ]; \ No newline at end of file diff --git a/application/wechat/controller/Config.php b/application/wechat/controller/Config.php index bac3c3ce5..d7ff0cf11 100644 --- a/application/wechat/controller/Config.php +++ b/application/wechat/controller/Config.php @@ -94,6 +94,7 @@ class Config extends BasicAdmin { } $refund_no = DataService::createSequence(10, 'wechat-pay-test'); if (false !== PayService::putWechatRefund($pay, $order_no, 1, $refund_no)) { + session('pay-test-order-no', null); $this->success('操作退款成功!', ''); } $this->error("操作退款失败,{$pay->errMsg}[{$pay->errCode}]"); diff --git a/application/wechat/controller/Notify.php b/application/wechat/controller/Notify.php index 9154445cd..029fc3013 100644 --- a/application/wechat/controller/Notify.php +++ b/application/wechat/controller/Notify.php @@ -43,7 +43,9 @@ class Notify extends Controller { //支付通知数据获取成功 if ($notifyInfo['result_code'] == 'SUCCESS' && $notifyInfo['return_code'] == 'SUCCESS') { // 记录支付通知数据 - Db::name('WechatPayNotify')->insert($notifyInfo); + if(!Db::name('WechatPayNotify')->insert($notifyInfo)){ + $pay->replyXml(['return_code' => 'ERROR', 'return_msg' => '系统记录微信通知时发生异常!']); + } $prepayMap = ['out_trade_no' => $notifyInfo['out_trade_no']]; $prepayData = Db::name('WechatPayPrepayid')->where($prepayMap)->find(); if (empty($prepayData)) {