From bb575731e7db790ab622636ef7a7628dbf409bab Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Thu, 9 Dec 2021 14:17:40 +0800 Subject: [PATCH] setter --- app/controller/api/Recharge.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controller/api/Recharge.php b/app/controller/api/Recharge.php index 3072963..340d251 100644 --- a/app/controller/api/Recharge.php +++ b/app/controller/api/Recharge.php @@ -90,13 +90,14 @@ class Recharge extends Base // $aa = '{"appid":"wxa02e44170bc722cd","bank_type":"OTHERS","cash_fee":"1","fee_type":"CNY","is_subscribe":"N","mch_id":"1605090111","nonce_str":"60f7d8a1e4ac8","openid":"oKrEm0ehgsy2ZTWzEva4tbLuUgFw","out_trade_no":"16268555858753004863","result_code":"SUCCESS","return_code":"SUCCESS","sign":"DB3F6CDCB7FBB3B9DDF7C0CC8BBD5AAD","time_end":"20210721162000","total_fee":"1","trade_type":"JSAPI","transaction_id":"4200001200202107217942681078"}'; // $message = json_decode($aa, true); $m = json_encode($message, JSON_UNESCAPED_UNICODE); - + $this->log($m); $recharge = RechargeRepository::getInstance()->getModel()->where(["order_num" => $message['out_trade_no']])->lock(true)->find(); if (empty($recharge)) { $this->log(sprintf("[微信支付回调][%s][%s]订单支付成功,但系统查无此订单 info:%s", date('Y-m-d H:i:s'), $message['out_trade_no'], $m), 'error'); return true;//订单不存在 } if ($recharge['state'] == RechargeModel::state_on) { + $this->log("订单已支付"); return true;//订单已经支付 } $business = BusinessRepository::getInstance()->getModel()->where(["code" => $recharge['business_code']])->lock(true)->find(); @@ -109,6 +110,7 @@ class Recharge extends Base if ($message['return_code'] == 'SUCCESS') { // return_code 表示通信状态,不代表支付状态 if (isset($message['result_code']) && $message['result_code'] == 'SUCCESS') { if (isset($message['trade_state']) && $message['trade_state'] == 'SUCCESS') { + $this->log("订单支付成功开始数据操作"); Db::startTrans(); try { //这里确定支付成功