|
|
|
@ -363,4 +363,34 @@ class PaymentService extends AbstractService
|
|
|
|
|
|
|
|
|
|
return ['payUrl' => 'http://146.70.113.165:9501/payment.html?token=' . $token];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function query($params)
|
|
|
|
|
{
|
|
|
|
|
$req = new PaymentQueryRequest($params);
|
|
|
|
|
$data = $req->getData();
|
|
|
|
|
$app = $req->getApp();
|
|
|
|
|
|
|
|
|
|
if (empty($data['outOrderNo'])) {
|
|
|
|
|
throw new BusinessException('订单号不能为空');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$order = Order::where('app_id', $app->app_id)->where('out_order_no', $data['outOrderNo'])->first();
|
|
|
|
|
if ($order) {
|
|
|
|
|
throw new BusinessException('订单不存在');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result = Api::paymentQuery(['outTradeNo' => $order->order_no]);
|
|
|
|
|
if (!$result->isSuccess()) {
|
|
|
|
|
throw new BusinessException($result->getMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->handlePayResult($result, $order);
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
'outOrderNo' => $data['outOrderNo'],
|
|
|
|
|
'orderNo' => $order->order_no,
|
|
|
|
|
'payState' => $result->get('payState'),
|
|
|
|
|
'amount' => $result->get('amount'),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|