<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\PayCenter\Listeners; use Illuminate\Support\Facades\Log; use Module\PayCenter\Biz\PayCenterBiz; use Module\PayCenter\Events\OrderExpiredEvent; use Module\PayCenter\Events\OrderPayedEvent; class PayListener { public function onOrderPayedEvent(OrderPayedEvent $Z8J51) { Log::info('PayCenter.PayListener.onOrderPayedEvent - ' . json_encode($Z8J51, JSON_UNESCAPED_UNICODE)); foreach (PayCenterBiz::all() as $sefXk) { if ($Z8J51->biz == $sefXk->name()) { $sefXk->onPayed($Z8J51->bizId, $Z8J51->order); } } } public function onOrderExpiredEvent(OrderExpiredEvent $Z8J51) { Log::info('PayCenter.PayListener.onOrderExpiredEvent - ' . json_encode($Z8J51, JSON_UNESCAPED_UNICODE)); foreach (PayCenterBiz::all() as $sefXk) { if ($Z8J51->biz == $sefXk->name()) { $sefXk->onExpired($Z8J51->bizId, $Z8J51->order); } } } public function subscribe($WNxvc) { $WNxvc->listen(OrderPayedEvent::class, '\\' . __CLASS__ . '@onOrderPayedEvent'); $WNxvc->listen(OrderExpiredEvent::class, '\\' . __CLASS__ . '@onOrderExpiredEvent'); } }