From 1e0a8d553c5de0269383468de808a7b6e5388b36 Mon Sep 17 00:00:00 2001 From: wangzeyan <258785420@qq.com> Date: Sun, 25 May 2025 10:03:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9B=9E=E8=B0=83=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E5=92=8C=E4=BA=8C=E7=BB=B4=E7=A0=81=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- niucloud/app/api/controller/pay/Pay.php | 21 +++++++++++++++++++++ niucloud/app/api/route/pay.php | 5 +++++ niucloud/app/service/api/pay/PayService.php | 14 ++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/niucloud/app/api/controller/pay/Pay.php b/niucloud/app/api/controller/pay/Pay.php index 2577459f..4b68528f 100644 --- a/niucloud/app/api/controller/pay/Pay.php +++ b/niucloud/app/api/controller/pay/Pay.php @@ -16,6 +16,7 @@ use core\base\BaseApiController; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; +use think\facade\Log; use think\Response; /** @@ -94,4 +95,24 @@ class Pay extends BaseApiController ]); return success('SUCCESS',(new PayService())->close($data['type'], $data['out_trade_no'])); } + + /** + * 获取支付二维码 + */ + public function getQrcode(){ + $data = $this->request->params([ + ['trade_type', ''], + ['trade_id', ''], + ['type', ''], + ]); + return success('SUCCESS',(new PayService())->getQrcode($data['type'], $data['trade_type'], $data['trade_id'])); + } + + public function qrcodeNotify() + { + // todo + Log::debug('qrcodeNotify'); + Log::debug(json_encode($this->request->param())); + return success('SUCCESS'); + } } diff --git a/niucloud/app/api/route/pay.php b/niucloud/app/api/route/pay.php index aa87da01..4d41f42d 100644 --- a/niucloud/app/api/route/pay.php +++ b/niucloud/app/api/route/pay.php @@ -19,6 +19,11 @@ Route::any('pay/notify/:channel/:type/:action', 'pay.Pay/notify') ->middleware(ApiChannel::class) ->middleware(ApiCheckToken::class) ->middleware(ApiLog::class); + +Route::any('pay/qrcodenotify', 'pay.Pay/qrcodeNotify') + ->middleware(ApiChannel::class) + ->middleware(ApiCheckToken::class) + ->middleware(ApiLog::class); /** * 路由 */ diff --git a/niucloud/app/service/api/pay/PayService.php b/niucloud/app/service/api/pay/PayService.php index f1e8c580..6fced6a9 100644 --- a/niucloud/app/service/api/pay/PayService.php +++ b/niucloud/app/service/api/pay/PayService.php @@ -148,4 +148,18 @@ class PayService extends BaseApiService public function getPayTypeByTrade(string $trade_type){ return $this->core_pay_service->getPayTypeByTrade($trade_type, $this->channel); } + + public function getQrcode() + { + // todo + + } + + /** + * 二维码支付回调 + */ + public function qrcodeNotify() + { + // todo + } }