|
|
@@ -1,35 +0,0 @@
|
|
|
-<?php
|
|
|
-declare(strict_types=1);
|
|
|
-
|
|
|
-namespace SixShop\WechatPay\Hook;
|
|
|
-
|
|
|
-use SixShop\Core\Attribute\Hook;
|
|
|
-use SixShop\Payment\Event\PaymentSuccessEvent;
|
|
|
-use SixShop\WechatPay\Config;
|
|
|
-use SixShop\WechatPay\Trait\MiniAppTrait;
|
|
|
-use think\facade\Log;
|
|
|
-
|
|
|
-class SpecialOrderHook
|
|
|
-{
|
|
|
- use MiniAppTrait;
|
|
|
-
|
|
|
- public function __construct(private Config $config)
|
|
|
- {
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 调试模式进行测试报备
|
|
|
- */
|
|
|
- #[Hook(PaymentSuccessEvent::class)]
|
|
|
- public function debugMode(PaymentSuccessEvent $event): void
|
|
|
- {
|
|
|
- if ($this->config->debug) {
|
|
|
- try {
|
|
|
- $this->opSpecialOrder($event->orderNo, 2);
|
|
|
- Log::info('特殊订单报备成功{order_no}', ['order_no' => $event->orderNo]);
|
|
|
- } catch (\Exception $e) {
|
|
|
- Log::error('特殊订单报备失败{order_no}--{code}--{msg}', ['order_no' => $event->orderNo, 'code' => $e->getCode(), 'msg' => $e->getMessage()]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|