Skip to content

Commit

Permalink
refactor(payment): 重构退款和交易事件的处理方式
Browse files Browse the repository at this point in the history
-移除 RefundChannelListener 中的 ShouldQueueAfterCommit 接口和 InteractsWithQueue trait
- 添加 Log 引用以支持日志记录
- 为 AbstractRefundEvent 和 AbstractTradeEvent 实现 ShouldDispatchAfterCommit 接口
- 优化事件处理逻辑,提高系统稳定性和可维护性
  • Loading branch information
liushoukun committed Dec 24, 2024
1 parent 98f4eb6 commit fd7f21b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@
namespace RedJasmine\Payment\Application\Listeners;


use Illuminate\Contracts\Queue\ShouldQueueAfterCommit;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Log;
use RedJasmine\Payment\Application\Jobs\ChannelRefundJob;
use RedJasmine\Payment\Domain\Events\Refunds\RefundCreatedEvent;

class RefundChannelListener implements ShouldQueueAfterCommit
class RefundChannelListener
{

use InteractsWithQueue;

public function __construct()
{
}

public function handle($event) : void
{



if ($event instanceof RefundCreatedEvent) {
// 调度任务
ChannelRefundJob::dispatch($event->refund->refund_no);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace RedJasmine\Payment\Domain\Events\Refunds;

use Illuminate\Contracts\Events\ShouldDispatchAfterCommit;
use Illuminate\Foundation\Events\Dispatchable;
use RedJasmine\Payment\Domain\Models\Refund;

abstract class AbstractRefundEvent
abstract class AbstractRefundEvent implements ShouldDispatchAfterCommit
{

use Dispatchable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace RedJasmine\Payment\Domain\Events\Trades;

use Illuminate\Contracts\Events\ShouldDispatchAfterCommit;
use Illuminate\Foundation\Events\Dispatchable;
use RedJasmine\Payment\Domain\Models\Trade;

abstract class AbstractTradeEvent
abstract class AbstractTradeEvent implements ShouldDispatchAfterCommit
{

use Dispatchable;
Expand Down

0 comments on commit fd7f21b

Please sign in to comment.