From f6aea0af8cf1bd56abbf8e807b3307b04c52f651 Mon Sep 17 00:00:00 2001 From: weigang Date: Wed, 12 Aug 2020 19:49:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E5=8D=95=E4=BF=AE=E6=94=B9=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=94=E5=9B=9E=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Constants/ErrorCode.php | 8 +++++++- app/Controller/NotifyController.php | 8 +++++++- app/Controller/OrderController.php | 5 +++-- app/Controller/PaymentController.php | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/Constants/ErrorCode.php b/app/Constants/ErrorCode.php index f6dde1c..eba612a 100644 --- a/app/Constants/ErrorCode.php +++ b/app/Constants/ErrorCode.php @@ -37,4 +37,10 @@ class ErrorCode extends AbstractConstants /** * @Message("Upload failure!") */ - const UPLOAD_INVALID = 200;} + const UPLOAD_INVALID = 200; + + /** + * @Message("Order failure!") + */ + const ORDER_FAILURE = 300; +} diff --git a/app/Controller/NotifyController.php b/app/Controller/NotifyController.php index 02aa0a3..177a84d 100644 --- a/app/Controller/NotifyController.php +++ b/app/Controller/NotifyController.php @@ -6,8 +6,14 @@ use App\Constants\LogLabel; class NotifyController extends BaseController { - public function wxmini() + public function wxminiOnline() { + // 获取参数 + + // 查询订单 + + // 开始处理 + $this->log->event( LogLabel::PAY_NOTIFY_WXMINI, json_encode($this->request->input()) diff --git a/app/Controller/OrderController.php b/app/Controller/OrderController.php index 89a1cad..ff18506 100644 --- a/app/Controller/OrderController.php +++ b/app/Controller/OrderController.php @@ -2,6 +2,7 @@ namespace App\Controller; +use App\Constants\ErrorCode; use App\Request\OrderOnlineRequest; use Hyperf\Di\Annotation\Inject; use App\Service\OrderServiceInterface; @@ -20,8 +21,8 @@ class OrderController extends BaseController { $orderMainId = $this->orderService->addOnlineOrder($request->validated()); if (!is_int($orderMainId)) { - return $this->w7result(500, (string)$orderMainId); + return $this->result(ErrorCode::ORDER_FAILURE, '', $orderMainId); } - return $this->w7result(200, (string)$orderMainId); + return $this->success(['order_id' => $orderMainId]); } } \ No newline at end of file diff --git a/app/Controller/PaymentController.php b/app/Controller/PaymentController.php index 29b88e3..50202b7 100644 --- a/app/Controller/PaymentController.php +++ b/app/Controller/PaymentController.php @@ -34,7 +34,7 @@ class PaymentController extends BaseController 'body' => '懒族生活 - 外卖下单', 'out_trade_no' => $orderMain->global_order_id, 'total_fee' => bcmul(floatval($orderMain->money), 100), - 'notify_url' => config('site_host') . '/v1/notify/wxmini', + 'notify_url' => config('site_host') . '/v1/notify/wxminiOnline', 'trade_type' => 'JSAPI', 'openid' => $data['openid'], ]);