From 6058a4e21a2170fa4ddb4d065666605c3636fae7 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Sat, 23 Sep 2023 16:32:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=94=AF=E4=BB=98=E5=9B=9E?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/Auth.php | 53 +++++++++----------------------- crmeb/services/WechatService.php | 6 ++-- 2 files changed, 16 insertions(+), 43 deletions(-) diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 665a408d..21957ecf 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -64,46 +64,21 @@ class Auth extends BaseController { public function dotest() { - $notify = [ - 'mchid' => '1635725673', - 'appid' => 'wx9d68c92b550ddd1e', - 'out_trade_no' => 'bzj20230923161859650e9f73c308f', - 'transaction_id' => '4200001919202309239135900670', - 'trade_type' => 'APP', - 'trade_state' => 'SUCCESS', - 'trade_state_desc' => '支付成功', - 'bank_type' => 'OTHERS', - 'attach' => 'margin', - 'success_time' => '2023-09-23T16:19:07+08:00', - 'payer' => [ - 'openid' => 'okLE26lLqzkfg9cdxoSuPd6ApHyo', - ], - 'amount' => [ - 'total' => 1, - 'payer_total' => 1, - 'currency' => 'CNY', - 'payer_currency' => 'CNY', - ], - 'scene_info' => [ - 'device_id' => 'shop system', - ] + $repository = app()->make(StoreOrderRepository::class); + $param = [ + "status" => 0, + "is_del" => 0, + "mer_id" => 1, + "pay_type" => 1, + "attach" => "margin", + "order_info" => '{"is_margin":1,"margin":"0.01"}', + "pay_price" => 0.01, + "order_sn" => "bzj" . date('YmdHis') . uniqid(), + "body" =>'哈哈哈', ]; - event('pay_success_margin', ['order_sn' => $notify['out_trade_no'], 'data' => $notify, 'is_combine' => 0]); - // $repository = app()->make(StoreOrderRepository::class); - // $param = [ - // "status" => 0, - // "is_del" => 0, - // "mer_id" => 1, - // "pay_type" => 1, - // "attach" => "margin", - // "order_info" => '{"is_margin":1,"margin":"0.01"}', - // "pay_price" => 0.01, - // "order_sn" => "bzj" . date('YmdHis') . uniqid(), - // "body" =>'哈哈哈', - // ]; - // $payType = 'weixinApp'; - // $service = new PayService($payType, $param); - // $payInfo = $service->pay(User::where(['uid'=>1])->find()); + $payType = 'weixinApp'; + $service = new PayService($payType, $param); + $payInfo = $service->pay(User::where(['uid'=>1])->find()); return app('json')->success([]); } diff --git a/crmeb/services/WechatService.php b/crmeb/services/WechatService.php index 90e3deac..57f03bd5 100644 --- a/crmeb/services/WechatService.php +++ b/crmeb/services/WechatService.php @@ -590,9 +590,8 @@ class WechatService $this->application->payment = new PaymentService($this->application->merchant); //TODO 微信支付 return $this->application->payment->handleNotify(function ($notify, $successful) { - Log::info('微信支付成功回调000' . var_export($notify, 1)); + Log::info('微信支付成功回调' . var_export($notify, 1)); if (!$successful) return false; - Log::info('微信支付成功回调111' . var_export($notify, 1)); try { event('pay_success_' . $notify['attach'], ['order_sn' => $notify['out_trade_no'], 'data' => $notify, 'is_combine' => 0]); } catch (\Exception $e) { @@ -606,9 +605,8 @@ class WechatService public function handleNotifyV3() { return $this->application->v3Pay->handleNotify(function ($notify, $successful) { - Log::info('微信支付成功回调0' . var_export($notify, 1)); + Log::info('微信支付成功回调' . var_export($notify, 1)); if (!$successful) return false; - Log::info('微信支付成功回调222' . var_export($notify, 1)); try { event('pay_success_' . $notify['attach'], ['order_sn' => $notify['out_trade_no'], 'data' => $notify, 'is_combine' => 0]); } catch (\Exception $e) {