From 833acbbc9982df00f07fcc4e90f98563bcb8e88e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 14 Mar 2023 17:28:06 +0800 Subject: [PATCH] 3 --- app/Controller/CallBackController.php | 3 +- app/Controller/UserController.php | 62 +++++++++++++-------------- 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 4bdc94c..f5fb591 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -12,6 +12,7 @@ use App\Model\OrderInquiryCoupon; use App\Model\OrderInquiryRefund; use App\Model\OrderProduct; use App\Model\OrderProductItem; +use App\Model\OrderProductRefund; use App\Model\Product; use App\Model\ProductPlatformAmount; use App\Model\UserCoupon; @@ -517,7 +518,7 @@ class CallBackController extends AbstractController $params = array(); $params['order_product_id'] = $order_product['order_product_id']; - OrderInquiryRefund::edit($params,$data); + OrderProductRefund::edit($params,$data); Db::commit(); } catch (\Exception $e) { diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php index 4a4ed78..c4e6691 100644 --- a/app/Controller/UserController.php +++ b/app/Controller/UserController.php @@ -90,39 +90,39 @@ class UserController extends AbstractController $out_trade_no = $this->request->input('out_trade_no'); // $generator = $this->container->get(IdGeneratorInterface::class); // - $WechatPay = new WechatPay(1,2); - - // 获取预支付交易会话标识 - $total = 0.01 * 100; - $prepay = $WechatPay->getJsapiPrepayId($out_trade_no,$total,"omgU35DlE-rxTAGgcBjOuc4xdcX8"); - if (empty($prepay)){ - return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败"); - } - - // 获取小程序支付配置 - $pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']); - return $this->response->json($pay_config); +// $WechatPay = new WechatPay(1,2); +// +// // 获取预支付交易会话标识 +// $total = 0.01 * 100; +// $prepay = $WechatPay->getJsapiPrepayId($out_trade_no,$total,"omgU35DlE-rxTAGgcBjOuc4xdcX8"); +// if (empty($prepay)){ +// return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败"); +// } +// +// // 获取小程序支付配置 +// $pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']); +// return $this->response->json($pay_config); // 发起退款 -// $WechatPay = new WechatPay(1); -// -// $params = array(); -// $params['order_inquiry_id'] = 1; -// $order_inquiry = OrderInquiry::getOne($params); -// -// -// $options = array(); -// $options['transaction_id'] = $order_inquiry['escrow_trade_no']; -// $options['out_refund_no'] = $order_inquiry['inquiry_refund_no']; -// $options['reason'] = "退款原因"; -// $options['amount'] = [ -// 'refund' => (int)1, -// 'total' => (int)1, -// 'currency' => "CNY", -// ]; -// -// $result = $WechatPay->refund($options); -// dump($result); + $WechatPay = new WechatPay(1,2); + + $params = array(); + $params['order_inquiry_id'] = 1; + $order_inquiry = OrderInquiry::getOne($params); + + + $options = array(); + $options['transaction_id'] = "4200001756202303145016495897"; + $options['out_refund_no'] = "123456"; + $options['reason'] = "退款原因"; + $options['amount'] = [ + 'refund' => (int)1, + 'total' => (int)1, + 'currency' => "CNY", + ]; + + $result = $WechatPay->refund($options); + dump($result); // 创建账号 $account = new Account();