diff --git a/app/api/controller/PayController.php b/app/api/controller/PayController.php index 576452c..d7bed88 100644 --- a/app/api/controller/PayController.php +++ b/app/api/controller/PayController.php @@ -38,4 +38,23 @@ class PayController extends BaseApiController } } } + + /** + * @notes 查询订单支付状态 + */ + public function wechatQuery(){ + $order_no=$this->request->get('order_no'); + $order = [ + 'out_trade_no' => $order_no, + ]; + $app=new PayService(0); + + $res = $app->wechat->query($order); + if ($res['trade_state'] == 'SUCCESS' && $res['trade_state_desc'] == '支付成功') { + PayNotifyLogic::handle('cashierclass', $res['out_trade_no'], $res); + return $this->success('支付成功'); + }else{ + return $this->fail('订单支付中'); + } + } } diff --git a/app/common/logic/PaymentLogic.php b/app/common/logic/PaymentLogic.php index 3972453..4cfdd71 100644 --- a/app/common/logic/PaymentLogic.php +++ b/app/common/logic/PaymentLogic.php @@ -95,7 +95,7 @@ class PaymentLogic extends BaseLogic $result = $wechat->wechat->pos($order)->toArray(); } catch (ExceptionException $e) { if(getenv('APP_DEBUG')==true){ - self::$error=$e->extra['message']; + self::$error=$e->extra['message']??$e->getMessage(); }else{ self::$error = $e->getMessage(); }