<?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 $u17bI) { Log::info('PayCenter.PayListener.onOrderPayedEvent - ' . json_encode($u17bI, JSON_UNESCAPED_UNICODE)); foreach (PayCenterBiz::all() as $oMd7I) { if ($u17bI->biz == $oMd7I->name()) { $oMd7I->onPayed($u17bI->bizId, $u17bI->order); } } } public function onOrderExpiredEvent(OrderExpiredEvent $u17bI) { Log::info('PayCenter.PayListener.onOrderExpiredEvent - ' . json_encode($u17bI, JSON_UNESCAPED_UNICODE)); foreach (PayCenterBiz::all() as $oMd7I) { if ($u17bI->biz == $oMd7I->name()) { $oMd7I->onExpired($u17bI->bizId, $u17bI->order); } } } public function subscribe($Cl2i3) { $Cl2i3->listen(OrderPayedEvent::class, '\\' . __CLASS__ . '@onOrderPayedEvent'); $Cl2i3->listen(OrderExpiredEvent::class, '\\' . __CLASS__ . '@onOrderExpiredEvent'); } }