diff --git a/app/data/service/payment/VoucherPaymentService.php b/app/data/service/payment/VoucherPaymentService.php index 36099f99a..2f76304dd 100644 --- a/app/data/service/payment/VoucherPaymentService.php +++ b/app/data/service/payment/VoucherPaymentService.php @@ -3,6 +3,8 @@ namespace app\data\service\payment; use app\data\service\PaymentService; +use think\admin\Exception; +use think\admin\extend\CodeExtend; /** * 凭证单据支付 @@ -12,20 +14,22 @@ use app\data\service\PaymentService; class VoucherPaymentService extends PaymentService { /** + * 订单数据查询 * @param string $orderNo * @return array */ public function query(string $orderNo): array { - // TODO: Implement query() method. + return []; } /** + * 支付通知处理 * @return string */ public function notify(): string { - // TODO: Implement notify() method. + return 'success'; } /** @@ -36,9 +40,18 @@ class VoucherPaymentService extends PaymentService * @param string $paymentRemark * @param string $paymentReturn * @return array + * @throws Exception + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException */ public function create(string $openid, string $orderNo, string $paymentAmount, string $paymentTitle, string $paymentRemark, string $paymentReturn = ''): array { - // TODO: Implement create() method. + // @todo 支付凭证需要再处理下 + $order = $this->app->db->name('ShopOrder')->where(['order_no' => $orderNo])->find(); + if (empty($order)) throw new Exception("订单不存在"); + if ($order['status'] !== 2) throw new Exception("不可发起支付"); + $this->updateOrder($orderNo, CodeExtend::uniqidDate(20), $paymentAmount, '支付凭证'); + return ['info' => '支付凭证上传成功!', 'status' => 1]; } } \ No newline at end of file