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